Skip to main content

A library for polling and processing jobs from API endpoints

Project description

JobPoller

A Python library for polling and processing jobs from API endpoints.

Installation

pip install jobpoller

Features

  • Configurable API endpoints and authentication
  • Flexible job processing with customizable scripts
  • Robust logging and error handling
  • Simple interface for creating job processing services

Usage

Basic Usage

from jobpoller import JobProcessor, JobConfig

# Create configuration
config = JobConfig(
    api_url="https://api.example.com",
    api_key="your-api-key",
    poll_endpoint="/queue/next",
    log_dir="queue_logs"
)

# Create job processor
processor = JobProcessor(
    config=config,
    logger_name="QueueProcessor",
    process_script="process_job.py",
    script_executor="python"
)

# Run the processor
processor.run()

Custom Job Processing

from jobpoller import JobProcessor, JobConfig

# Create configuration
config = JobConfig(
    api_url="https://api.example.com",
    api_key="your-api-key",
    poll_endpoint="/renders/next",
    log_dir="render_logs"
)

# Custom job parser function
def parse_render_job(job_data):
    job_id = job_data.get("msgId")
    message = json.loads(job_data.get("message"))
    return {
        "job_id": job_id,
        "floorPlanId": message.get("floorPlanId"),
        "styleId": message.get("styleId")
    }

# Create job processor
processor = JobProcessor(
    config=config,
    logger_name="RenderProcessor",
    process_script="process_blend_automated.sh",
    script_executor="bash",
    job_parser=parse_render_job
)

# Run the processor
processor.run()

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

superbright_jobpoller-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

superbright_jobpoller-0.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file superbright_jobpoller-0.1.0.tar.gz.

File metadata

  • Download URL: superbright_jobpoller-0.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for superbright_jobpoller-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cfa75a6837a713e5de8271201d928e1aa74e4e61d2b2150cb66e1cf43e1d512c
MD5 fd45c351873da89896495679d777fcf9
BLAKE2b-256 8b88bf028583219b5e50b42a4c716a65f4528af6ea0fefdd526406a5f6414a48

See more details on using hashes here.

File details

Details for the file superbright_jobpoller-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for superbright_jobpoller-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6274fd458a5baf450c514c6dba2374a1f4fb3cd83a130f5bf4f46bfbc4594666
MD5 5d8103fa05ae84d648f27abe85a05b25
BLAKE2b-256 d023f377cc96515428606725084fae9c3c592e7d677be840c71da8c0eac68972

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page