Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
pya committed Jul 25, 2015
2 parents 3c4af66 + 583a001 commit a6fcc9a
Show file tree
Hide file tree
Showing 20 changed files with 1,297 additions and 226 deletions.
8 changes: 8 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
Revision history
----------------
v0.2.5 2015-07-21
* Add mailbox module
* Remove ActorHub, RemoteActor and ActorAddressBook
* Set debug to false as default to avoid tokens to be displayed in IPython Notebooks
* Add -o --outfile option to pyc file generation
* Add commandline option to generate pretty-printed AST
* Add commandline options to convert mochi file Python source file
* Fix some bugs
v0.2.4.2, 2015-05-06
* Fix a bug related to eventlet's monkey patching on Python 3.2 (pypy3)
v0.2.4.1, 2015-05-06
Expand Down
50 changes: 42 additions & 8 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,48 @@ sleep(1)
sleep(1)
# -> foo 1000
# -> bar 2000
```

### Distributed Computing
```python
# comsumer.mochi
from mochi.actor.mailbox import KombuMailbox, ZmqInbox

remote_actor = RemoteActor('tcp://localhost:9999/test')
remote_actor ! ['remote!', 3000]
def consumer():
receive:
'exit':
print('exit!')
other:
print(other)
consumer()

hub = ActorHub('tcp://*:9999')
hub.register('test', actor2)
hub.run()
mailbox = KombuMailbox('sqs://<access_key_id>@<secret_access_key>:80//',
'<queue_name>',
dict(region='<region>'))
spawn_with_mailbox(consumer, mailbox)

mailbox = ZmqInbox('tcp://*:9999')
spawn_with_mailbox(consumer, mailbox)

wait_all()
# -> remote! 3000
```

```python
# producer.mochi
from mochi.actor.mailbox import KombuMailbox, ZmqOutbox

mailbox = KombuMailbox('sqs://<access_key_id>@<secret_access_key>:80//',
'<queue_name>',
dict(region='<region>'))
mailbox ! [1, 2, 3]
mailbox ! 'exit'

mailbox = ZmqOutbox('tcp://localhost:9999')
mailbox ! [4, 5, 6]
mailbox ! 'exit'
```


### Flask
```python
from flask import Flask
Expand Down Expand Up @@ -189,16 +219,20 @@ aif([10, 20], first(it), "empty")
- pyrsistent >= 0.10.1
- pathlib >= 1.0.1
- eventlet >= 0.17.1
- pyzmq >= 14.5.0
- msgpack-python >= 0.4.6
- kazoo >= 2.0
- typeannotations >= 0.1.0


## Installation
```sh
$ pip3 install mochi
```
### Optional Installation
```sh
$ pip3 install flask Flask-RESTful Pillow RxPY # to run the examples
$ pip3 install pyzmq # to use ZmqInbox and ZmqOutbox
$ pip3 install kombu # to use KombuMailbox
$ pip3 install boto # to use SQS as transport of KombuMailbox
```

Th error of the following may occur when you run Mochi on PyPy.
Expand Down
52 changes: 43 additions & 9 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,45 @@ sleep(1)
sleep(1)
# -> foo 1000
# -> bar 2000
```

### 分散コンピューティング
```python
# comsumer.mochi
from mochi.actor.mailbox import KombuMailbox, ZmqInbox

remote_actor = RemoteActor('tcp://localhost:9999/test')
remote_actor ! ['remote!', 3000]
def consumer():
receive:
'exit':
print('exit!')
other:
print(other)
consumer()

hub = ActorHub('tcp://*:9999')
hub.register('test', actor2)
hub.run()
mailbox = KombuMailbox('sqs://<access_key_id>@<secret_access_key>:80//',
'<queue_name>',
dict(region='<region>'))
spawn_with_mailbox(consumer, mailbox)

mailbox = ZmqInbox('tcp://*:9999')
spawn_with_mailbox(consumer, mailbox)

wait_all()
# -> remote! 3000
```

```python
# producer.mochi
from mochi.actor.mailbox import KombuMailbox, ZmqOutbox

mailbox = KombuMailbox('sqs://<access_key_id>@<secret_access_key>:80//',
'<queue_name>',
dict(region='<region>'))
mailbox ! [1, 2, 3]
mailbox ! 'exit'

mailbox = ZmqOutbox('tcp://localhost:9999')
mailbox ! [4, 5, 6]
mailbox ! 'exit'
```

### Flask
Expand Down Expand Up @@ -199,16 +228,21 @@ aif([10, 20], first(it), "empty")
- pyrsistent >= 0.10.1
- pathlib >= 1.0.1
- eventlet >= 0.17.1
- pyzmq >= 14.5.0
- msgpack-python >= 0.4.6
- kazoo >= 2.0
- typeannotations >= 0.1.0

## インストール

```sh
$ pip3 install mochi
$ pip3 install flask Flask-RESTful Pillow RxPY # examplesを実行するために必要
```

### オプションのインストール
```sh
$ pip3 install flask Flask-RESTful Pillow RxPY # to run the examples
$ pip3 install pyzmq # to use ZmqInbox and ZmqOutbox
$ pip3 install kombu # to use KombuMailbox
$ pip3 install boto # to use SQS as transport of KombuMailbox
```

PyPyでmochiを実行した場合に下記のエラーになることがあります。
Expand Down
50 changes: 42 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,48 @@ sleep(1)
sleep(1)
# -> foo 1000
# -> bar 2000
```

### Distributed Computing
```python
# comsumer.mochi
from mochi.actor.mailbox import KombuMailbox, ZmqInbox

remote_actor = RemoteActor('tcp://localhost:9999/test')
remote_actor ! ['remote!', 3000]
def consumer():
receive:
'exit':
print('exit!')
other:
print(other)
consumer()

hub = ActorHub('tcp://*:9999')
hub.register('test', actor2)
hub.run()
mailbox = KombuMailbox('sqs://<access_key_id>@<secret_access_key>:80//',
'<queue_name>',
dict(region='<region>'))
spawn_with_mailbox(consumer, mailbox)

mailbox = ZmqInbox('tcp://*:9999')
spawn_with_mailbox(consumer, mailbox)

wait_all()
# -> remote! 3000
```

```python
# producer.mochi
from mochi.actor.mailbox import KombuMailbox, ZmqOutbox

mailbox = KombuMailbox('sqs://<access_key_id>@<secret_access_key>:80//',
'<queue_name>',
dict(region='<region>'))
mailbox ! [1, 2, 3]
mailbox ! 'exit'

mailbox = ZmqOutbox('tcp://localhost:9999')
mailbox ! [4, 5, 6]
mailbox ! 'exit'
```


### Flask
```python
from flask import Flask
Expand Down Expand Up @@ -189,17 +219,21 @@ aif([10, 20], first(it), "empty")
- pyrsistent >= 0.10.1
- pathlib >= 1.0.1
- eventlet >= 0.17.1
- pyzmq >= 14.5.0
- msgpack-python >= 0.4.6
- kazoo >= 2.0
- typeannotations >= 0.1.0
- astunparse>=1.2.2


## Installation
```sh
$ pip3 install mochi
```
### Optional Installation
```sh
$ pip3 install flask Flask-RESTful Pillow RxPY # to run the examples
$ pip3 install pyzmq # to use ZmqInbox and ZmqOutbox
$ pip3 install kombu # to use KombuMailbox
$ pip3 install boto # to use SQS as transport of KombuMailbox
```

The following may occur when you run Mochi on PyPy.
Expand Down
58 changes: 50 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,48 @@ Actor
# -> foo 1000
# -> bar 2000
remote_actor = RemoteActor('tcp://localhost:9999/test')
remote_actor ! ['remote!', 3000]
hub = ActorHub('tcp://*:9999')
hub.register('test', actor2)
hub.run()
Distributed Computing
~~~~~~~~~~~~~~~~~~~~~
.. code:: python
# comsumer.mochi
from mochi.actor.mailbox import KombuMailbox, ZmqInbox
def consumer():
receive:
'exit':
print('exit!')
other:
print(other)
consumer()
mailbox = KombuMailbox('sqs://<access_key_id>@<secret_access_key>:80//',
'<queue_name>',
dict(region='<region>'))
spawn_with_mailbox(consumer, mailbox)
mailbox = ZmqInbox('tcp://*:9999')
spawn_with_mailbox(consumer, mailbox)
wait_all()
# -> remote! 3000
.. code:: python
# producer.mochi
from mochi.actor.mailbox import KombuMailbox, ZmqOutbox
mailbox = KombuMailbox('sqs://<access_key_id>@<secret_access_key>:80//',
'<queue_name>',
dict(region='<region>'))
mailbox ! [1, 2, 3]
mailbox ! 'exit'
mailbox = ZmqOutbox('tcp://localhost:9999')
mailbox ! [4, 5, 6]
mailbox ! 'exit'
Flask
~~~~~
Expand Down Expand Up @@ -212,9 +245,7 @@ Requirements
- pyrsistent >= 0.10.1
- pathlib >= 1.0.1
- eventlet >= 0.17.1
- pyzmq >= 14.5.0
- msgpack-python >= 0.4.6
- kazoo >= 2.0
- typeannotations >= 0.1.0

Installation
Expand All @@ -225,6 +256,17 @@ Installation
$ pip3 install mochi
$ pip3 install flask Flask-RESTful Pillow RxPY # to run the examples
Optional Installation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: sh
$ pip3 install flask Flask-RESTful Pillow RxPY # to run the examples
$ pip3 install pyzmq # to use ZmqInbox and ZmqOutbox
$ pip3 install kombu # to use KombuMailbox
$ pip3 install boto # to use SQS as transport of KombuMailbox
Th error of the following may occur when you run Mochi on PyPy.

..
Expand Down
Loading

0 comments on commit a6fcc9a

Please sign in to comment.