Jobs¶
Interface Job¶
- class portal.vidispine.ijob.JobHelper(slug=None, user=None, runas=None, *args, **kwargs)¶
This is an interface to the job API in VidiREST
- Args:
slug: Optional: A Vidispine job ID, used as default in getJob and updateJobPriority
- user: Optional: User to use towards the API. If not set, automaticallys fall back to the
admin user defined in the config file.
runas: Optional: Vidispine “runas” argument to execute commands as a different user
- getAllImportJobs(state='STARTED', *args)¶
Gets all import jobs from Vidispine with state set to “state”.
- Args:
state: Defines a filter of job state. Default is STARTED.
- Returns:
A list of VSJob objects
- getAllIngestJobs(*args, **kwargs)¶
Gets all import jobs from Vidispine with state set to “state”.
- Args:
args & kwargs forwarded to getAllJobs.
- Returns:
A list of VSJob objects
- getAllJobs(types=None, states=None, first=1, number=1000, sort='jobId desc', metadata=False, user=False, include_steps=False, jobmetadata=None, *args)¶
Gets all jobs from Vidispine.
- Args:
types: A list of job types that is filtered on
states: A list of job states that is filtered on
first: The number of the first job. Default is 1
number: The number of jobs that should be returned. Default is 1000
sort_order: The sort order of the list. Default is ‘desc’
metadata: Boolean value for including job metadata or not. Default is False.
include_steps: Boolean value for including job step data or not. Default is False. This must be set to True to use granular getProgress() on the returned jobs.
user: Only include jobs created by the current user. Default is False.
jobmetadata: Filter the job list using jobmetadata (see vidispine documentation for details)
- Returns:
A list of VSJob objects
- getAllJobsForItem(item_id, job_type=None, max_hits=100, *args)¶
Get all transcode jobs for an item. All jobs for that specific item will be returned.
- Args:
item_id: ID for the relevant item.
job_type: Limits the function to jobs of this type. E.g. TRANSCODE
max_hits: The number of jobs to retrieve from Vidispine.
- Returns:
A list of VSJob objects
- getAllNotifications()¶
Returns a list of job notifications
- getAllTranscodeJobsForItem(item_id, max_hits=100, *args)¶
Get all transcode jobs for an item. All jobs for that specific item will be returned.
- Args:
item_id: ID for the relevant item.
max_hits: The number of jobs to retrieve from Vidispine.
- Returns:
A list of VSJob objects
- getJob(slug=None, *args)¶
Gets a job from Vidispine. Returned VSJob includes all data, including steps and metadata.
- Parameters
slug – The Vidispine job ID, if not given the class Job ID is used
- Returns
a VSJob object for the job
- Return type
- getJobProblem(job_id, *args)¶
Retrieve information about any problem a job might have encountered
- Args:
job_id: The id of the job
- Returns:
The job problem in string format
- getTaskDefinition(task_type, *args)¶
Gets a task definition from Vidispine.
- Args:
task_type: Defines the task type to be fetched
- Returns:
A Vidispine task type json structure
- getTotalJobCount(types=None, states=None, sort_order='desc', metadata=False, user=False, *args)¶
Gets a count of the total amount of jobs in Vidispine based on certain criteria.
I am going to cache this so that the query is not hammered (based on the number)
- Args:
types: A list of job types that is filtered on
states: A list of job states that is filtered on
first: The number of the first job. Default is 0
number: The number of jobs that should be returned. Default is 1000
sort_order: The sort order of the list. Default is ‘desc’
metadata: Boolean value for including job metadata or not. Default is True.
- Returns:
A count.
- reRun(job_id, *args)¶
Retrieves an existing job, duplicates it and starts the duplicated version.
- Args:
job_id: The id of the job to be re-run
- Returns:
VSJob object
- removeTaskDefinition(taskdef_id, *args)¶
Remove a task definition from Vidispine.
- Args:
taskdef_id: The Id of the task definition to be removed
- Returns:
None
- updateJobPriority(slug=None, priority='MEDIUM')¶
Update a job in Vidispine
- Args:
slug: The Vidispine job ID, if not given the class Job ID is used
- Returns:
A VSJob object.
- userHasAccessToJob(job_id, user, action)¶
Returns True if the user has access to the given job, else False
- Parameters
job_id – ID of the VSJob the user is trying to access
user – User object of the user trying to do a job action
action – Job action the user is trying to do. I.E “abort”, “rerun”, etc
- Returns
True if the user has access to the job, else False