Last active
December 25, 2020 20:15
-
-
Save codemation/5619471189c71a9c313fb5c21d155cdd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# subprocess job template for easyrpc_job_runner | |
import asyncio, sys, json | |
from easyrpc.proxy import EasyRpcProxy | |
async def job(reuest_id, payload): | |
proxy = await EasyRpcProxy.create( | |
'0.0.0.0', | |
8690, | |
'/ws/jobs', | |
server_secret='abcd1234', | |
namespace='jobs' | |
) | |
# insert work here | |
results = 'subprocess results' # dont use this | |
await proxy['send_results'](request_id, results) | |
if __name__ == '__main__': | |
payload = json.load(sys.stdin) | |
request_id = sys.argv[1] | |
asyncio.run(job(request_id, payload)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment