Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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
Ejemplo n.º 5
0
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)
Ejemplo n.º 6
0
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)
Ejemplo n.º 7
0
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)
Ejemplo n.º 8
0
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
Ejemplo n.º 9
0
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)
Ejemplo n.º 10
0
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)
Ejemplo n.º 11
0
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)
Ejemplo n.º 12
0
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)
Ejemplo n.º 13
0
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
Ejemplo n.º 14
0
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)
Ejemplo n.º 15
0
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
Ejemplo n.º 16
0
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
Ejemplo n.º 17
0
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]
Ejemplo n.º 18
0
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)
Ejemplo n.º 19
0
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)
Ejemplo n.º 20
0
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)
Ejemplo n.º 21
0
def launchSpecAndWait(spec):
    """Launch a new job with the given spec xml data.
    This call waits on the server until the job is committed
    in the DB.
    @type spec: str
    @param spec: XML string containing job spec
    @rtype: List<Job>
    @return: List of Jobs that were submitted
    """
    jobSeq = Cuebot.getStub('job').LaunchSpecAndWait(
        job_pb2.JobLaunchSpecAndWaitRequest(spec=spec),
        timeout=Cuebot.Timeout).jobs
    return [Job(j) for j in jobSeq.jobs]
Ejemplo n.º 22
0
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)
Ejemplo n.º 23
0
def findFrame(job, layer, number):
    """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
    @type number: int
    @param number: the frame number
    @rtype: Frame
    @return: the frame matching the query"""
    return Frame(
        Cuebot.getStub('frame').FindFrame(job_pb2.FrameFindFrameRequest(
            job=job, layer=layer, frame=number),
                                          timeout=Cuebot.Timeout).frame)
Ejemplo n.º 24
0
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.

import logging

from cuebot import Cuebot

Cuebot.init()

import api
import wrappers
import search

from exception import CueException
from exception import EntityNotFoundException
from util import id
from util import logPath
from util import proxy
from util import rep


class __NullHandler(logging.Handler):
    def emit(self, record):
Ejemplo n.º 25
0
def allocSetTag(alloc, tag):
    return Cuebot.getStub('allocation').SetTag(facility_pb2.AllocSetTagRequest(
        allocation=alloc, tag=tag),
                                               timeout=Cuebot.Timeout)
Ejemplo n.º 26
0
def allocSetName(alloc, name):
    return Cuebot.getStub('allocation').SetName(
        facility_pb2.AllocSetNameRequest(allocation=alloc, name=name),
        timeout=Cuebot.Timeout)
Ejemplo n.º 27
0
def allocSetBillable(alloc, is_billable):
    return Cuebot.getStub('allocation').SetBillable(
        facility_pb2.AllocSetBillableRequest(allocation=alloc,
                                             value=is_billable),
        timeout=Cuebot.Timeout)
Ejemplo n.º 28
0
def deleteAllocation(alloc):
    return Cuebot.getStub('allocation').Delete(
        facility_pb2.AllocDeleteRequest(allocation=alloc),
        timeout=Cuebot.Timeout)
Ejemplo n.º 29
0
def getAllocation(allocId):
    return Allocation(
        Cuebot.getStub('allocation').Get(
            facility_pb2.AllocGetRequest(id=allocId),
            timeout=Cuebot.Timeout).allocation)
Ejemplo n.º 30
0
def getOwner(id):
    """Return an Owner object from the id or name."""
    return Cuebot.getStub('owner').GetOwner(
        host_pb2.OwnerGetOwnerRequest(name=id), timout=Cuebot.Timeout).owner