semvec/pypi-packages huggingface dataset:
ValiotWorker 6.0.1
Enables running Python functions as standalone jobs based on interaction with valiot-jobs API
Keywords: ValiotWorker

# 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)
```
timed-batch-worker 0.0.5
Python library for efficiently batch-processing workloads asynchronously with batch-size- and time-based flushes.
Requires Python: >=3
Keywords: batch,worker,asynchronous,threading,timed

# Timed Batch Worker

Python library for efficiently batch-processing workloads asynchronously with batch-size- and time-based flushes using short-circuiting events.

## Installation
```bash
pip install timed-batch-worker
```

## Usage
```python
from timed_batch_worker import TimedBatchWorker


# Handle the batched items
def handle_batch(items):
  http.post('/api/logs/bulk', data=items)


# Create a worker that flushes the queue when:
# 1. The batch contains 20 objects, or
# 2. Five seconds have passed since the last flush
worker = TimedBatchWorker(
  handler=handle_batch,
  flush_interval=5,
  flush_batch_size=20,
)

# Worker started in separate thread to avoid throttling main event loop
# in case the batch handler includes synchronous workloads.
worker.start()


# Add objects to the current batch at any time
@app.get('/users/create')
def create_user():
  ...

  # Hand off an object to the worker
  worker.enqueue({
    'event': 'USER_CREATED',
    'data': user
  })

  ...
```