Enables running Python functions as standalone jobs based on interaction with valiot-jobs API
Project description
python-gql-worker
Enables running Python functions as standalone jobs based on interaction with valiot-jobs API
installation
pipenv install valiotworker
Deployment:
python setup.py sdist bdist_wheel && python -m twine upload dist/* --skip-existing # UPLOAD TO PYPI
API < v0.4.0
Job footprint:
@valiotWorker.job(...)
def my_job(job_id, update_job, kwargs)
...
Parameters:
- job_id: Number representing the Identifier for this job
- update_job: function to update status of current job (FINISHED, ERROR, etc)
- kwargs: dictionary aliasing the custom params (from job's "input" attribute, for retrocompatibility)
API >= v0.5.0
@valiotWorker.job(...)
def my_job(my_arg1, my_arg2, ... my_arg_n, **_)
...
Starting from v0.5.0, every argument is accessed by its keyword.
You may have any arbitrary number of arguments which get loaded from the job input parameter, and the special arguments:
- update_job: function to update status of current job (FINISHED, ERROR, etc)
- job: dictionary containing job information (id, status, queue, insertion date, etc)
- queue: dictionary containing Job's parent Queue information (name, type, frequency, etc)
- kwargs: dictionary aliasing the custom params (from job's "input" attribute, for retrocompatibility)
Worker configuration:
This configurations must run before worker.run()
(event loop)
# Poll with subscription
worker.setPollingMode(PollingMode.SUBSCRIPTION)
# or Poll with Queries
worker.setPollingMode(PollingMode.QUERY)
worker.setJobConfigMode(JobConfigMode.KEEP)
# Config remains untouched (Allow persistence of config on DB)
worker.setJobConfigMode(JobConfigMode.KEEP)
# Config updates with job params (Allow quick iteration of job setups)
worker.setJobConfigMode(JobConfigMode.SYNC)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ValiotWorker-5.1.0.tar.gz
(30.1 kB
view hashes)
Built Distribution
Close
Hashes for ValiotWorker-5.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00ad87020a4a96df5ed600642cac308c4aa0fcc0da06eaf4ffc32b9408e01ea9 |
|
MD5 | f2bb1816cbb27403481d3b0e5fb26fa2 |
|
BLAKE2b-256 | d0d824a5fba3c2780d5815df7d6b154d217c569ee3c485cb8737032f3aacb5eb |