# 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)
```python
# Poll with subscription
worker.setPollingMode(PollingMode.SUBSCRIPTION)
# or Poll with Queries
worker.setPollingMode(PollingMode.QUERY)
```
worker.setJobConfigMode(JobConfigMode.KEEP)
```python
# 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)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/valiot/python-gql-worker",
"name": "ValiotWorker",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "ValiotWorker",
"author": "Valiot",
"author_email": "hiring@valiot.io",
"download_url": "https://files.pythonhosted.org/packages/87/dd/0e8ad699d47c0a7de28f09e7b0505555cc99cc06521f6b464b746c7da5f5/ValiotWorker-6.0.1.tar.gz",
"platform": null,
"description": "# python-gql-worker\nEnables running Python functions as standalone jobs based on interaction with valiot-jobs API\n\n# installation\n`pipenv install valiotworker`\n\n# Deployment:\n`python setup.py sdist bdist_wheel && python -m twine upload dist/* --skip-existing # UPLOAD TO PYPI`\n\n## API < v0.4.0\nJob footprint:\n\n```\n@valiotWorker.job(...)\ndef my_job(job_id, update_job, kwargs)\n ...\n```\nParameters:\n* job_id: Number representing the Identifier for this job\n* update_job: function to update status of current job (FINISHED, ERROR, etc)\n* kwargs: dictionary aliasing the custom params (from job's \"input\" attribute, for retrocompatibility)\n\n## API >= v0.5.0\n```\n@valiotWorker.job(...)\ndef my_job(my_arg1, my_arg2, ... my_arg_n, **_)\n ...\n```\n\nStarting from v0.5.0, every argument is accessed by its keyword.\n\nYou may have any arbitrary number of arguments which get loaded from the job **input** parameter, and the special arguments:\n* update_job: function to update status of current job (FINISHED, ERROR, etc)\n* job: dictionary containing job information (id, status, queue, insertion date, etc)\n* queue: dictionary containing Job's parent Queue information (name, type, frequency, etc)\n* kwargs: dictionary aliasing the custom params (from job's \"input\" attribute, for retrocompatibility)\n\n### Worker configuration:\nThis configurations must run before `worker.run()` (event loop)\n```python\n# Poll with subscription\nworker.setPollingMode(PollingMode.SUBSCRIPTION)\n# or Poll with Queries\nworker.setPollingMode(PollingMode.QUERY)\n```\nworker.setJobConfigMode(JobConfigMode.KEEP)\n```python\n# Config remains untouched (Allow persistence of config on DB)\nworker.setJobConfigMode(JobConfigMode.KEEP)\n# Config updates with job params (Allow quick iteration of job setups)\nworker.setJobConfigMode(JobConfigMode.SYNC)\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Enables running Python functions as standalone jobs based on interaction with valiot-jobs API",
"version": "6.0.1",
"project_urls": {
"Homepage": "https://github.com/valiot/python-gql-worker"
},
"split_keywords": [
"valiotworker"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f953d1959de821744951b1e49332b137597d1de03770ff24f70007bd8f71262f",
"md5": "be2ab3591612cbb91fe79803c0a0bd3e",
"sha256": "5b919b6b4f3ff0900471cbc22512036e534aa7dc019e3a1aca96219e6cd90d85"
},
"downloads": -1,
"filename": "ValiotWorker-6.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "be2ab3591612cbb91fe79803c0a0bd3e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 39364,
"upload_time": "2023-07-11T21:35:01",
"upload_time_iso_8601": "2023-07-11T21:35:01.042512Z",
"url": "https://files.pythonhosted.org/packages/f9/53/d1959de821744951b1e49332b137597d1de03770ff24f70007bd8f71262f/ValiotWorker-6.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "87dd0e8ad699d47c0a7de28f09e7b0505555cc99cc06521f6b464b746c7da5f5",
"md5": "e9babe785a4037b7f6cd1f6c78a3e39a",
"sha256": "ff55d7b8ef2277ca38e10a88886eabeae4fbf40d206d3b20bad54eb0db0bcf45"
},
"downloads": -1,
"filename": "ValiotWorker-6.0.1.tar.gz",
"has_sig": false,
"md5_digest": "e9babe785a4037b7f6cd1f6c78a3e39a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 31449,
"upload_time": "2023-07-11T21:35:03",
"upload_time_iso_8601": "2023-07-11T21:35:03.490972Z",
"url": "https://files.pythonhosted.org/packages/87/dd/0e8ad699d47c0a7de28f09e7b0505555cc99cc06521f6b464b746c7da5f5/ValiotWorker-6.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-11 21:35:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "valiot",
"github_project": "python-gql-worker",
"github_not_found": true,
"lcname": "valiotworker"
}