def deleteShow(show_id): """Deletes a show @type show_id: str @param show_id: A show id to delete""" show = findShow(show_id) Cuebot.getStub('show').Delete(show_pb2.ShowDeleteRequest(show=show), timeout=Cuebot.Timeout)
def getJobs(**options): """ Returns an array of Job objects using optional search criteria. Search criteria is supplied as a variable list of arguments. For example: getJobs(show=["pipe"]) would return only pipe jobs. Possible args: - job: job names - match: job name substring match - regex: a job name search by regular expression - id: a job search by unique id - show: show names - shot: shot names - user: user names @rtype: List<Job> @return: a list of jobs """ criteria = search.JobSearch.criteriaFromOptions(**options) jobSeq = Cuebot.getStub('job').GetJobs( job_pb2.JobGetJobsRequest(r=criteria), timeout=Cuebot.Timeout).jobs return [Job(j) for j in jobSeq.jobs]
def getActiveShows(): """Returns a list of all active shows. @rtype: list<Show> @return: List of show objects""" showSeq = Cuebot.getStub('show').GetActiveShows( show_pb2.ShowGetActiveShowsRequest(), timeout=Cuebot.Timeout).shows return [Show(s) for s in showSeq.shows]
def getAllocations(): """Returns a list of allocation objects @rtype: list<Allocation> @return: List of allocation objects""" allocationSeq = Cuebot.getStub('allocation').GetAll( facility_pb2.AllocGetAllRequest(), timeout=Cuebot.Timeout).allocations return [Allocation(a) for a in allocationSeq.allocations]
def getGroup(uniq): """Returns a Group object from its uniq id. @rtype: Group @return: The matching group object""" return Group( Cuebot.getStub('group').GetGroup(job_pb2.GroupGetGroupRequest(id=uniq), timeout=Cuebot.Timeout).group)
def getHostWhiteboard(): """ @rtype: list<Host> @return: NestedHost """ nestedHostSeq = Cuebot.getStub('host').GetHostWhiteboard( host_pb2.HostGetHostWhiteboardRequest(), timeout=Cuebot.Timeout).nested_hosts return [NestedHost(nh) for nh in nestedHostSeq.nested_hosts]
def createService(data): """ Return the default service list. Services define the default application features. @rtype list<Service> """ return Cuebot.getStub('service').CreateService( service_pb2.ServiceCreateServiceRequest(data=data), timeout=Cuebot.Timeout).service
def getSystemStats(): """Returns the system stats for a random opencue server in the cluster. This is used mainly by admins for troubleshooting opencue problems. @rtype: SystemStats @return: a struct of opencue application information.""" return Cuebot.getStub('cue').GetSystemStats( cue_pb2.CueGetSystemStatsRequest(), timeout=Cuebot.Timeout).stats
def getDefaultServices(): """ Return the default service list. Services define the default application features. @rtype list<Service> """ response = Cuebot.getStub('service').GetDefaultServices( service_pb2.ServiceGetDefaultServicesRequest(), timeout=Cuebot.Timeout) return response.services.services
def getFrame(uniq): """Returns a Frame object from the unique id. @type uniq: a unique identifier. @param uniq: id @rtype: Frame @return: A Frame object""" return Frame( Cuebot.getStub('frame').GetFrame(job_pb2.FrameGetFrameRequest(id=uniq), timeout=Cuebot.Timeout).frame)
def getService(name): """ Return the default service list. Services define the default application features. @rtype Service """ return Cuebot.getStub('service').GetService( service_pb2.ServiceGetServiceRequest(name=name), timeout=Cuebot.Timeout).service
def getHost(uniq): """Returns a Host object from a unique identifier @type uniq: a unique identifier. @param uniq: an id @rtype: Host @return: A Host object""" return Host( Cuebot.getStub('host').GetHost(host_pb2.HostGetHostsRequest(id=uniq), timeout=Cuebot.Timeout).host)
def getLayer(uniq): """Returns a Layer object for the given layer id. @type uniq: a unique identifier. @param uniq: id @rtype: Layer @return: A Layer object""" return Layer( Cuebot.getStub('layer').GetLayer(job_pb2.LayerGetLayerRequest(id=uniq), timeout=Cuebot.Timeout).layer)
def isJobPending(name): """Returns true if there is an active job in the cue in the pending state. @type name: str @param name: A job name @rtype: bool @return: true if the job exists""" return Cuebot.getStub('job').IsJobPending( job_pb2.JobIsJobPendingRequest(name=name), timeout=Cuebot.Timeout).value
def findShow(name): """Returns a list of show objects @type name: str @param name: A string that represents a show to return. @rtype: Show @return: List of show objects""" return Show( Cuebot.getStub('show').FindShow( show_pb2.ShowFindShowRequest(name=name), timeout=Cuebot.Timeout).show)
def findAllocation(name): """Returns the Allocation object that matches the name. @type name: str @param name: The name of the allocation @rtype: Allocation @return: Allocation object""" return Allocation( Cuebot.getStub('allocation').Find( facility_pb2.AllocFindRequest(name=name), timeout=Cuebot.Timeout).allocation)
def getDepend(uniq): """Finds a dependency from its unique ID @type id: str @param id: the depends' unique id @rtype: Depend @return: a dependency""" return Depend( Cuebot.getStub('depend').GetDepend( depend_pb2.DependGetDependRequest(id=uniq), timeout=Cuebot.Timeout).depend)
def findSubscription(name): """Returns the subscription object that matches the name. @type name: str @param name: The name of the subscription @rtype: Subscription @return: Subscription object""" return Subscription( Cuebot.getStub('subscription').Find( subscription_pb2.SubscriptionFindRequest(name=name), timeout=Cuebot.Timeout).subscription)
def getFacility(name): """Return a given facility by name or unique ID. @type name: str @param name: A facility name or unique ID. @rtype: Facility @return: A facility object. """ return Cuebot.getStub('facility').Get( facility_pb2.FacilityGetRequest(name=name), timeout=Cuebot.Timeout).facility
def findHost(name): """Returns the host for the matching hostname @type name: str @param name: The unique name of a host @rtype: Host @return: The matching host object""" return Host( Cuebot.getStub('host').FindHost( host_pb2.HostFindHostRequest(name=name), timeout=Cuebot.Timeout).host)
def createShow(show): """Creates a new show @type show: str @param show: A new show name to create @rtype: Show @return: The created show object""" return Show( Cuebot.getStub('show').CreateShow( show_pb2.ShowCreateShowRequest(name=show), timeout=Cuebot.Timeout).show)
def getJob(uniq): """Returns a Job object for the given job name. This will only return one or zero active job. @type name: str @param name: A job name @rtype: Job @return: Job object""" return Job( Cuebot.getStub('job').GetJob(job_pb2.JobGetJobRequest(id=uniq), timeout=Cuebot.Timeout).job)
def getSubscription(uniq): """Returns a Subscription object from a unique identifier @type uniq: a unique identifier. @param uniq: an id @rtype: Subscription @return: A Subscription object""" return Subscription( Cuebot.getStub('subscription').Get( subscription_pb2.SubscriptionGetRequest(id=uniq), timeout=Cuebot.Timeout).subscription)
def getFrames(job, **options): """Finds frames in a job that match the search critieria @type job: A unique job identifier. @param: An id @rtype: List<Frame> @return: a list of matching frames""" criteria = search.FrameSearch.criteriaFromOptions(**options) framesSeq = Cuebot.getStub('frame').GetFrames( job_pb2.FrameGetFramesRequest(job=job, r=criteria), timeout=Cuebot.Timeout).frames return [Frame(f) for f in framesSeq.frames]
def launchSpec(spec): """Launch a new job with the given spec xml data. This call returns immediately but there is guarantee that the job was written to the DB. @type spec: str @param spec: XML string containing job spec @rtype: List<str> @return: List of job names that were submitted """ return Cuebot.getStub('job').LaunchSpec( job_pb2.JobLaunchSpecRequest(spec=spec), timeout=Cuebot.Timeout).names
def getJobNames(**options): """Returns a list of job names that match the search parameters. See getJobs for the job query options. @type options: dict @param options: a variable list of search criteria @rtype: list<str> @return: List of matching job names""" criteria = search.JobSearch.criteriaFromOptions(**options) return Cuebot.getStub('job').GetJobNames( job_pb2.JobGetJobNamesRequest(r=criteria), timeout=Cuebot.Timeout).names
def findFilter(show_name, filter_name): """Returns the matching filter(for testing) @type show_name: str @param show_name: a show name @type filter_name: str @param filter_name: a filter name @rtype: Filter @return: The matching filter""" return Filter( Cuebot.getStub('filter').FindFilter(filter_pb2.FilterFindFilterRequest( show=show_name, name=filter_name), timeout=Cuebot.Timeout).filter)
def findLayer(job, layer): """Finds and returns a layer from the specified pending job @type job: str @param job: the job name @type layer: str @param layer: the layer name @rtype: Layer @return: the layer matching the query""" return Layer( Cuebot.getStub('layer').FindLayer(job_pb2.LayerFindLayerRequest( job=job, layer=layer), timeout=Cuebot.Timeout).layer)
def findGroup(show, group): """Returns a group object @type show: str @param show: The name of a show @type group: str @param group: The name of a group @rtype: Group @return: The matching group object""" return Group( Cuebot.getStub('group').FindGroup(job_pb2.GroupFindGroupRequest( show=show, name=group), timeout=Cuebot.Timeout).group)
def createAllocation(name, tag, facility): """Creates and returns an allocation. The host tag will be the lowercase of the allocation name. @type name: str @param name: The name of the allocation @type tag: str @param tag: The tag for the allocation @rtype: Allocation @return: The created allocation object""" return Allocation( Cuebot.getStub('allocation').Create(facility_pb2.AllocCreateRequest( name=name, tag=tag, facility=facility), timeout=Cuebot.Timeout).allocation)