ipeterov / convenient-rpc

Convenient APIs for calling python functions remotely at many workers.
MIT License
0 stars 0 forks source link

Add a pythonic wrapper to HTTP API #4

Closed ipeterov closed 8 years ago

ipeterov commented 8 years ago

The point is to have something that behaves like imap_unordered method from mupltiprocessing.Pool, but accepts dicts describing functions instead of actual function objects, so we can do stuff like that:

api = API('mytaskserver.com')

function = {
    "package": "my_package",
    "function": "foo"
}

argskwargslist = [
    [
        (42, 1), 
        {
            "bar": True,
            "spam": False
        }
    ],

    [
        (13, 2), 
        {
            "bar": False,
            "spam": True
        }
    ],
]

for result in api.imap_unordered(task, argskwargslist):
    print(result)