Job
class
- class almapiwrapper.config.Job(job_id: str, zone: str, env: Literal['P', 'S'] = 'P', job_type: Literal['M', 'S', 'O'] = 'M')
Bases:
Record
Class representing a job :param job_id: ID of the job :param zone: zone of the job :param env: environment of the entity: ‘P’ for production and ‘S’ for sandbox :param job_type: type of the job: ‘M’ for manual, ‘S’ for scheduled
- Variables
job_id – initial value: ID of the job
zone – initial value: zone of the fee
env – initial value: environment of the entity: ‘P’ for production and ‘S’ for sandbox
job_type – initial value: type of the job: ‘M’ for manual, ‘S’ for scheduled
instance_id – initial value: str
area – initial value: ‘Conf’
format – initial value: ‘xml’
- static build_headers(data_format: Literal['json', 'xml'], zone: str, area: str, rights: Literal['R', 'RW'] = 'RW', env: Optional[Literal['P', 'S']] = 'P') Dict
Build the headers for the API calls.
- Parameters
data_format – “json” or “xml”
zone – optional, if indicated allow to make the query in an other IZ
area – area of the record, bibs, users for example
rights – “R” for read only or “RW” for write and read rights
env – environment of the api call: ‘P’ for production, ‘S’ for sandbox
- Returns
dict with the headers
- check_instance_state(instance_id: Optional[str] = None) Optional[Dict]
Check the state of the provided instance id or of instance started with
almapiwrapper.config.Job.run()
- Parameters
instance_id – optional parameter indicating the instance to check. If not provided it will use the instance id of a job started
Note
If the record encountered an error, this method will be skipped.
- property data: Optional[Union[Dict, Element, DataFrame]]
Property that get xml data with API call. If not available, make an api call
- Returns
xml data, dictionary or pandas dataframe
- get_instance_info(instance_id: Optional[str] = None) Optional['JsonData']
Get information about a specif job instance
- Parameters
instance_id – optional parameter indicating the instance to check. If not provided it will use the instance id of a job started
- Returns
almapiwrapper.record.JsonData
with the details of a job instance return None in case of error
Note
If the record encountered an error, this method will be skipped.
- get_instances(self) Optional['JsonData']
Get the list of the instances of a job in json format
- Returns
almapiwrapper.record.JsonData
with the list of job instances return None in case of error
Note
If the record encountered an error, this method will be skipped.
- run(parameters: Optional[Union[str, 'XmlData']] = '<job/>') Optional['XmlData']
Run the job with the provided parameters
- Parameters
parameters –
almapiwrapper.record.XmlData
or string with the parameters to use for the job. For some jobs no parameters are required.- Returns
almapiwrapper.record.XmlData
with the instance of the job or None in case of error.
Note
If the record encountered an error, this method will be skipped.