Table of Contents
openeo_fastapi.client.jobs
Class and model to define the framework and partial application logic for interacting with Jobs.
Classes: - JobsRegister: Framework for defining and extending the logic for working with BatchJobs. - Job: The pydantic model used as an in memory representation of an OpenEO Job.
Job Objects
class Job(BaseModel)
Pydantic model representing an OpenEO Job.
job_id
Config Objects
class Config()
Pydantic model class config.
get_orm
@classmethod
def get_orm(cls)
Get the ORM model for this pydantic model.
patch
def patch(patch: Any)
Update pydantic model with changed fields from a new model instance.
JobsRegister Objects
class JobsRegister(EndpointRegister)
The JobRegister to regulate the application logic for the API behaviour.
__init__
def __init__(settings, links) -> None
Initialize the JobRegister.
Arguments:
settings
AppSettings - The AppSettings that the application will use.links
Links - The Links to be used in some function responses.
list_jobs
def list_jobs(limit: Optional[int] = 10,
user: User = Depends(Authenticator.validate))
List the user's most recent BatchJobs.
Arguments:
limit
int - The limit to apply to the length of the list.user
User - The User returned from the Authenticator.
Returns:
JobsGetResponse
- A list of the user's BatchJobs.
create_job
def create_job(body: JobsRequest,
user: User = Depends(Authenticator.validate))
Create a new BatchJob.
Arguments:
body
JobsRequest - The Job Request that should be used to create the new BatchJob.user
User - The User returned from the Authenticator.
Returns:
Response
- A general FastApi response to signify the changes where made as expected. Specific response headers need to be set in this response to ensure certain behaviours when being used by OpenEO client modules.
update_job
def update_job(job_id: uuid.UUID,
body: JobsRequest,
user: User = Depends(Authenticator.validate))
Update the specified BatchJob with the contents of the provided JobsRequest.
Arguments:
job_id
JobId - A UUID job id.body
JobsRequest - The Job Request that should be used to update the new BatchJob.user
User - The User returned from the Authenticator.
Raises:
HTTPException
- Raises an exception with relevant status code and descriptive message of failure.
Returns:
Response
- A general FastApi response to signify the changes where made as expected.
get_job
def get_job(job_id: uuid.UUID, user: User = Depends(Authenticator.validate))
Get and return the metadata for the BatchJob.
Arguments:
job_id
JobId - A UUID job id.user
User - The User returned from the Authenticator.
Raises:
HTTPException
- Raises an exception with relevant status code and descriptive message of failure.
Returns:
BatchJob
- The metadata for the requested BatchJob.
delete_job
def delete_job(job_id: uuid.UUID,
user: User = Depends(Authenticator.validate))
Delete the BatchJob.
Arguments:
job_id
JobId - A UUID job id.body
JobsRequest - The Job Request that should be used to create the new BatchJob.user
User - The User returned from the Authenticator.
Raises:
HTTPException
- Raises an exception with relevant status code and descriptive message of failure.
estimate
def estimate(job_id: uuid.UUID, user: User = Depends(Authenticator.validate))
Estimate the cost for the BatchJob.
Arguments:
job_id
JobId - A UUID job id.body
JobsRequest - The Job Request that should be used to create the new BatchJob.user
User - The User returned from the Authenticator.
Raises:
HTTPException
- Raises an exception with relevant status code and descriptive message of failure.
logs
def logs(job_id: uuid.UUID, user: User = Depends(Authenticator.validate))
Get the logs for the BatchJob.
Arguments:
job_id
JobId - A UUID job id.body
JobsRequest - The Job Request that should be used to create the new BatchJob.user
User - The User returned from the Authenticator.
Raises:
HTTPException
- Raises an exception with relevant status code and descriptive message of failure.
get_results
def get_results(job_id: uuid.UUID,
user: User = Depends(Authenticator.validate))
Get the results for the BatchJob.
Arguments:
job_id
JobId - A UUID job id.body
JobsRequest - The Job Request that should be used to create the new BatchJob.user
User - The User returned from the Authenticator.
Raises:
HTTPException
- Raises an exception with relevant status code and descriptive message of failure.
start_job
def start_job(job_id: uuid.UUID, user: User = Depends(Authenticator.validate))
Start the processing for the BatchJob.
Arguments:
job_id
JobId - A UUID job id.body
JobsRequest - The Job Request that should be used to create the new BatchJob.user
User - The User returned from the Authenticator.
Raises:
HTTPException
- Raises an exception with relevant status code and descriptive message of failure.
cancel_job
def cancel_job(job_id: uuid.UUID,
user: User = Depends(Authenticator.validate))
Cancel the processing of the BatchJob.
Arguments:
job_id
JobId - A UUID job id.user
User - The User returned from the Authenticator.
Raises:
HTTPException
- Raises an exception with relevant status code and descriptive message of failure.
delete_job
def delete_job(job_id: uuid.UUID,
user: User = Depends(Authenticator.validate))
Delete the BatchJob from the database.
Arguments:
job_id
JobId - A UUID job id.body
JobsRequest - The Job Request that should be used to create the new BatchJob.user
User - The User returned from the Authenticator.
Raises:
HTTPException
- Raises an exception with relevant status code and descriptive message of failure.
process_sync_job
def process_sync_job(body: JobsRequest = JobsRequest(),
user: User = Depends(Authenticator.validate))
Start the processing of a synchronous Job.
Arguments:
body
JobsRequest - The Job Request that should be used to create the new BatchJob.user
User - The User returned from the Authenticator.
Raises:
HTTPException
- Raises an exception with relevant status code and descriptive message of failure.