Job
The Job class represents a queued job and provides methods for execution and status management.
Usage
from whatsnext.api.client import Server
server = Server("http://localhost:8000")
project = server.get_project("my-project")
# Get next job
job = project.pop()
if job:
print(f"Processing: {job.name}")
print(f"Parameters: {job.parameters}")
print(f"Status: {job.status}")
# Execute the job
job.run()
Job Status
Jobs progress through the following states:
PENDING- Job created but not queuedQUEUED- Job in queue waiting to be processedRUNNING- Job currently being executedCOMPLETED- Job finished successfullyFAILED- Job execution failed
API Reference
Job
Represents a job to be executed.
A Job is a data object containing execution parameters. The actual execution is handled by a Formatter, keeping job definitions runtime-agnostic.
run
Execute the job using the resource's formatter.
| PARAMETER | DESCRIPTION |
|---|---|
resource
|
Resource containing the client and formatter to use.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
Exit code from the command execution. |