Job
Job
Represents an asynchronous operation in the Fiddler platform.
A Job tracks the execution of long-running operations such as data publishing, model artifact uploads, surrogate model training, and other async tasks. Jobs provide status monitoring, progress tracking, and error handling for operations that may take significant time to complete.
Key Features:
Status Monitoring: Real-time tracking of job execution state
Progress Tracking: Percentage completion for running operations
Error Reporting: Detailed error messages and failure reasons
Timeout Handling: Configurable timeouts for job completion
Responsive Polling: Efficient status checking with backoff strategies
Job States:
PENDING: Job queued and waiting to start execution
STARTED: Job actively running with progress updates
SUCCESS: Job completed successfully
FAILURE: Job failed with detailed error information
RETRY: Job being retried after a failure
REVOKED: Job cancelled or terminated
Example
Jobs are created automatically by async operations and cannot be instantiated directly. Use Job.get() to retrieve existing jobs and the monitoring methods to track progress and handle completion.
Initialize a Job instance.
Creates a job object for tracking asynchronous operations. This constructor is typically used internally when deserializing API responses rather than for direct job creation.
Jobs are automatically created by async operations (like Model.publish(), Model.add_artifact(), etc.) and cannot be created directly. Use Job.get() to retrieve existing jobs and monitoring methods to track progress.
Return type: None
classmethod get(id_, verbose=False)
Retrieve a job by its unique identifier.
Fetches a job from the Fiddler platform using its UUID. This is the primary way to retrieve job information for monitoring async operations.
Parameters
verbose
bool
✗
None
Whether to include detailed task execution information. When True, provides additional debugging and progress details.
Returns
The job instance with current status, progress, and metadata.
Return type: Job
Raises
NotFound – If no job exists with the specified ID.
ApiError – If there’s an error communicating with the Fiddler API.
Example
This method makes an API call to fetch the latest job state from the server. Use verbose=True when debugging failed jobs to get additional task details.
watch()
Monitor job progress with real-time status updates.
Continuously polls the job status at specified intervals and yields updated job instances. This method provides real-time monitoring of job progress and automatically handles network errors and retries.
Parameters
interval
int
✗
None
Polling interval in seconds between status checks. Default is configured by JOB_POLL_INTERVAL (typically 5-10 seconds).
timeout
int
✗
None
Maximum time in seconds to monitor the job before giving up. Default is configured by JOB_WAIT_TIMEOUT (typically 1800 seconds).
Yields
Job – Updated job instances with current status and progress.
Raises
TimeoutError – If the job doesn’t complete within the specified timeout.
AsyncJobFailed – If the job fails during execution (raised by wait() method). Return type: Iterator[Job]
Example
This method handles network errors gracefully and continues monitoring. It automatically stops when the job reaches a terminal state (SUCCESS, FAILURE, or REVOKED). Use shorter intervals for more responsive monitoring but be mindful of API rate limits.
wait()
Wait for job completion with automatic progress logging.
Blocks execution until the job completes (successfully or with failure). Provides automatic progress logging and raises an exception if the job fails. This is the most convenient method for simple job completion waiting.
Parameters
interval
int
✗
None
Polling interval in seconds between status checks. Default is configured by JOB_POLL_INTERVAL (typically 5-10 seconds).
timeout
int
✗
None
Maximum time in seconds to wait for job completion. Default is configured by JOB_WAIT_TIMEOUT (typically 1800 seconds).
Raises
TimeoutError – If the job doesn’t complete within the specified timeout.
AsyncJobFailed – If the job fails during execution, includes error details. Return type: None
Example
This method automatically logs progress updates to the logger. For custom progress handling, use the watch() method instead. The method blocks the current thread until completion, so consider using watch() for non-blocking monitoring in async applications.
Last updated
Was this helpful?