当前位置: 首页>>代码示例>>Python>>正文


Python Job.Job类代码示例

本文整理汇总了Python中Job.Job的典型用法代码示例。如果您正苦于以下问题:Python Job类的具体用法?Python Job怎么用?Python Job使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Job类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, id=None, 
                 name=None, 
                 route=[], 
                 priority=0, 
                 dueDate=0, 
                 orderDate=0, 
                 extraPropertyDict=None,
                 order=None, 
                 currentStation=None,
                 isCritical=False,**kw):
        Job.__init__(self, id, name, route=route, priority=priority, dueDate=dueDate, orderDate=orderDate, 
                     extraPropertyDict=extraPropertyDict, isCritical=isCritical,currentStation=currentStation)
        self.order=order            # parent order of the order component
        # TODO: in case the order is not given as argument (when the component is given as WIP) have to give a manager as argument
        #     or create the initiate the parent order not as WIP 
        if self.order:
            # if the order is not None, and the order.manager is given
            if self.order.manager:
                self.manager=self.order.manager
        # variable to be used by OperatorRouter
        self.hot=False
        # TODO: isCritical argument is deprecated
#         self.isCritical=isCritical  # this should be self.order.isCritical. Added now for testing
        # used by printRoute
        if self.order:
            self.alias=self.order.alias+'C'+str(len(G.OrderComponentList))
开发者ID:Kodextor,项目名称:dream,代码行数:26,代码来源:Mould.py

示例2: __init__

 def __init__(self, id=None, 
              name=None, 
              route=[], 
              priority=0, 
              dueDate=0, 
              orderDate=0, 
              extraPropertyDict=None,
              order=None, 
              remainingProcessingTime={}, 
              remainingSetupTime={},
              currentStation=None,
              isCritical=False,**kw):
     Job.__init__(self, id, name, route=route, priority=priority, dueDate=dueDate, orderDate=orderDate, 
                  extraPropertyDict=extraPropertyDict, isCritical=isCritical,
                  remainingProcessingTime=remainingProcessingTime, remainingSetupTime=remainingSetupTime,
                  currentStation=currentStation)
     self.order=order            # parent order of the order component
     # TODO: in case the order is not given as argument (when the component is given as WIP) have to give a manager as argument
     #     or create the initiate the parent order not as WIP 
     if self.order:
         # if the order is not None, and the order.manager is given
         if self.order.manager:
             self.manager=self.order.manager
     # used by printRoute
     if self.order:
         self.alias=self.order.alias+'C'+str(len(G.OrderComponentList))
开发者ID:PanosBarlas,项目名称:dream,代码行数:26,代码来源:Mould.py

示例3: __init__

 def __init__(self, id=None, name=None, 
                 route=[], 
                 priority=0, 
                 dueDate=0, 
                 orderDate=0, 
                 extraPropertyDict=None,
                 order=None, 
                 remainingProcessingTime={}, 
                 remainingSetupTime={},
                 currentStation=None,
                 requestingComponent = None, 
                 isCritical=False,
                 **kw):
     Job.__init__(self, id=id, name=name, route=route, priority=priority, dueDate=dueDate, orderDate=orderDate, 
                  extraPropertyDict=extraPropertyDict, isCritical=isCritical, 
                  remainingProcessingTime=remainingProcessingTime, remainingSetupTime=remainingSetupTime,
                  currentStation=currentStation)
     self.order=order            # parent order of the order component
     # TODO: in case the order is not given as argument (when the component is given as WIP) have to give a manager as argument
     #     or create the initiate the parent order not as WIP 
     if self.order:
         # if the order is not None, and the order.manager is given
         if self.order.manager:
             self.manager=self.order.manager
     #=======================================================================
     # if the componentType of the component is Auxiliary then there need a requesting Component be defined
     # the requestingComponent is the component that needs the auxiliary component during its processing
     # the auxiliary component should then be added to the requestingComponent's auxiliaryList
     self.requestingComponent = requestingComponent  # the id of the requesting component
     #=======================================================================
     # used by printRoute
     if self.order:
         self.alias=self.order.alias+'C'+str(len(G.OrderComponentList))
         
     route = [x for x in self.route]       #    copy self.route
     #Below it is to assign an order decomposition if it was not assigned in JSON
     #have to talk about it with NEX
     odAssigned=False
     for element in route:
         elementIds = element.get('stationIdsList',[])
         for obj in G.ObjList:
             for elementId in elementIds:
                 if obj.id==elementId and obj.type=='OrderDecomposition':
                     odAssigned=True 
     if not odAssigned:
         odId=None
         for obj in G.ObjList:
             if obj.type=='OrderDecomposition':
                 odId=obj.id
                 break
         if odId:
             route.append({'stationIdsList':[odId],\
                           'processingTime':\
                          {'distributionType':'Fixed',\
                           'mean':'0'}})
         self.route=route
     # add the OrderDesign to the DesignList and the OrderComponentList
     G.OrderComponentList.append(self)
     G.DesignList.append(self)
     G.WipList.append(self)
开发者ID:PanosBarlas,项目名称:dream,代码行数:60,代码来源:OrderDesign.py

示例4: execute_maint_script

 def execute_maint_script(self, script_name):
     '''
     execute a user-defined function
     script_name -- name of the function to run
     '''
     Package.execute_maint_script(self)
     script_path = "%s/%s.py" % (self.maint_dir, script_name)
     start_dir = get_slash_cwd()
     os.chdir(self.maint_dir)
     if not os.path.isfile(script_path):
         msg = "%s does not exist" % script_path
         raise BadPackage, (self.name, msg)
     sys.path.append(self.maint_dir )
     import_string = 'import %s' % script_name
     cmd = 'status = %s.execute(self.config, Logger)' % script_name
     job = Job(import_string, cmd, self.config)
     status = job.execute()
     sys.path.remove(self.maint_dir)
     os.chdir(start_dir)
     if status == None:
         status = OK
     if type(status) != type(1):
         msg = "Invalid status type (%s: '%s')"
         Logger.warning(msg % (type(status), status))
         status = FAIL
     return status
开发者ID:psbanka,项目名称:bombardier,代码行数:26,代码来源:PackageV4.py

示例5: add_job

    def add_job(self, name, version, priority, dist, mailto=None, arch=None):
        """Add a job"""

        if not arch:
            arch = self.cfg.arch[0]

        if not Dists().get_dist(dist, arch):
            RebuilddLog.error("Couldn't find dist/arch in the config file for %s_%s on %s/%s, don't adding it" \
                           % (name, version, dist, arch))
            return False

        pkgs = Package.selectBy(name=name, version=version)
        if pkgs.count():
            # If several packages exists, just take the first
            pkg = pkgs[0]
        else:
            # Maybe we found no packages, so create a brand new one!
            pkg = Package(name=name, version=version, priority=priority)

        jobs_count = Job.selectBy(package=pkg, dist=dist, arch=arch, mailto=mailto, status=JobStatus.WAIT).count()
        if jobs_count:
            RebuilddLog.error("Job already existing for %s_%s on %s/%s, don't adding it" \
                           % (pkg.name, pkg.version, dist, arch))
            return False

        job = Job(package=pkg, dist=dist, arch=arch)
        job.status = JobStatus.WAIT
        job.arch = arch
        job.mailto = mailto

        log = Log(job=job)

        RebuilddLog.info("Added job for %s_%s on %s/%s for %s" \
                      % (name, version, dist, arch, mailto))
        return True
开发者ID:kryskool,项目名称:rebuildd,代码行数:35,代码来源:Rebuildd.py

示例6: __init__

    def __init__(self, id=None, name=None, 
                    route=[], 
                    priority=0, 
                    dueDate=None, 
                    orderDate=None, 
                    extraPropertyDict=None,
                    componentType='Basic', 
                    order=None, 
                    requestingComponent = None, 
                    readyForAssembly = 0, 
                    isCritical=False):
        Job.__init__(self, id, name, route, priority, dueDate, orderDate, extraPropertyDict, isCritical)
        self.auxiliaryList=[]       # Holds the auxiliary components that the component needs for a certain processing
        self.order=order            # parent order of the order component
        # TODO: in case the order is not given as argument (when the component is given as WIP) have to give a manager as argument
        #     or create the initiate the parent order not as WIP 
        if self.order:
            # if the order is not None, and the order.manager is given
            if self.order.manager:
                self.manager=self.order.manager
        # TODO: isCritical argument is deprecated
#         self.isCritical=isCritical  # this should be self.order.isCritical. Added now for testing
        self.componentType = componentType  # the type of the component which can be Basic/Secondary/Auxiliary
        # if the componentType of the component is Auxiliary then there need a requesting Component be defined
        # the requestingComponent is the component that needs the auxiliary component during its processing
        # the auxiliary component should then be added to the requestingComponent's auxiliaryList
        self.requestingComponent = requestingComponent  # the id of the requesting component
        self.readyForAssembly = readyForAssembly        # flag informing weather the component was received
                                                        #     by the MouldAssembleBuffer
        
开发者ID:mmariani,项目名称:dream,代码行数:29,代码来源:OrderComponent.py

示例7: __init__

 def __init__(self, id=None, name=None, 
                 route=[], 
                 priority=0, 
                 dueDate=None, 
                 orderDate=None, 
                 extraPropertyDict=None,
                 order=None, 
                 requestingComponent = None, 
                 isCritical=False,
                 **kw):
     Job.__init__(self, id, name, route, priority, dueDate, orderDate, extraPropertyDict, isCritical)
     self.order=order            # parent order of the order component
     # TODO: in case the order is not given as argument (when the component is given as WIP) have to give a manager as argument
     #     or create the initiate the parent order not as WIP 
     if self.order:
         # if the order is not None, and the order.manager is given
         if self.order.manager:
             self.manager=self.order.manager
     # if the componentType of the component is Auxiliary then there need a requesting Component be defined
     # the requestingComponent is the component that needs the auxiliary component during its processing
     # the auxiliary component should then be added to the requestingComponent's auxiliaryList
     self.requestingComponent = requestingComponent  # the id of the requesting component
     # used by printRoute
     if self.order:
         self.alias=self.order.alias+'C'+str(len(G.OrderComponentList))
开发者ID:Kodextor,项目名称:dream,代码行数:25,代码来源:OrderDesign.py

示例8: main

    def main(self):
        print "JobStarter starting up"
        while True:
            rawData = self.r_server.blpop("Granted_Queue")[1] 
            self.runParamDict = pickle.loads(rawData)


            # write the paramFile back to disk (why?)
            #YAML.write(self.runParamDict, self.runParamDict['Filename'])

            try:
                # setup correct job class and start up job
                if self.runParamDict['ClassType'] == 'Local':
                    print "Starting local job thread for '%s'" % self.runParamDict['Filename']
                    j = Job(configDict=self.runParamDict)
                else:
                    print "Starting remote job for '%s'" % self.runParamDict['Filename']
                    j = RemoteJob(configDict=self.runParamDict)
                
                j.start()

                print "Job Started."
            
                pollTime = time.time() + self.runParamDict['PollPeriod'] * 60
                self.r_server.zadd("Running_Queue", rawData, pollTime)
            
            except:
                print "The following job failed:'%s'" % self.runParamDict['Filename']
                print time.asctime(),
                traceback.print_exc()
                print 
                self.r_server.rpush("Result_Queue", rawData)

            # since this blocks, clear after queuing up
            self.runParamDict = None
开发者ID:Cogwell,项目名称:JobManager,代码行数:35,代码来源:JobManager.py

示例9: get_jobs

    def get_jobs(self, name, version=None, dist=None, arch=None):
        """Dump a job status"""
        
        if version:
            pkgs = Package.selectBy(name=name, version=version)
        else:
            pkgs = Package.selectBy(name=name)

        if not pkgs.count():
            return []

        retjobs = []
        if dist and arch:
            for pkg in pkgs:
                retjobs.extend(Job.selectBy(package=pkg, dist=dist, arch=arch))
        elif dist:
            for pkg in pkgs:
                retjobs.extend(Job.selectBy(package=pkg, dist=dist))
        elif arch:
            for pkg in pkgs:
                retjobs.extend(Job.selectBy(package=pkg, arch=arch))
        else:
            for pkg in pkgs:
                retjobs.extend(Job.selectBy(package=pkg))
        
        return retjobs
开发者ID:kryskool,项目名称:rebuildd,代码行数:26,代码来源:Rebuildd.py

示例10: GET

    def GET(self, name=None, version=None):
        jobs = []

        if version:
            title = "%s %s" % (name, version)
            package = "%s/%s" % (name, version)
            query = Job.select(IN(Job.q.package,
                            Select(Package.q.id, AND(
                                Package.q.name==name,
                                Package.q.version==version))))
        else:
            title = package = name
            query = Job.select(IN(Job.q.package,
                            Select(Package.q.id, Package.q.name==name)))

        result, page, nb_pages = _paginate_query(query.orderBy(
                DESC(Job.q.package)))

        jobs.extend(result)
        return render.base(page=render.tab(jobs=jobs, page=page, nb_pages=nb_pages), \
                hostname=socket.gethostname(), \
                title=title, \
                package=package, \
                archs=RebuilddConfig().arch, \
                dists=RebuilddConfig().get('build', 'dists').split(' '))
开发者ID:rtt-mmk,项目名称:rebuildd,代码行数:25,代码来源:RebuilddHTTPServer.py

示例11: add_job

 def add_job(self, cpu_steps, mem_per_step, net_sched, usb_sched):
     with PyOS.pid_mutex:
         PyOS.pid += 1
         job = Job(PyOS.pid, cpu_steps, mem_per_step, net_sched, usb_sched, self)
         self.cpu.add_job()
         self.mem.add_job()
         self.jobs.append(job)
         job.start()
开发者ID:yeti,项目名称:PyOS,代码行数:8,代码来源:PyOS.py

示例12: get_new_jobs

    def get_new_jobs(self):
        """Feed jobs list with waiting jobs and lock them"""

        max_new = self.cfg.getint('build', 'max_jobs')
        count_current = len(self.jobs)

        with self.jobs_locker:
            if count_current >= max_new:
                return 0

            jobs = []
            for dist in Dists().dists: 
                jobs.extend(Job.selectBy(status=JobStatus.WAIT, dist=dist.name, arch=dist.arch)[:max_new])

            count_new = 0
            for job in jobs:
                # Look for higher versions ?
                if self.cfg.getboolean('build', 'build_more_recent'):
                    packages = Package.selectBy(name=job.package.name)
                    candidate_packages = []
                    candidate_packages.extend(packages)
                    candidate_packages.sort(cmp=Package.version_compare)
                    candidate_packages.reverse()
                    newjob = None

                    # so there are packages with higher version number
                    # try to see if there's a job for us
                    for cpackage in candidate_packages:
                        candidate_jobs = []
                        candidate_jobs.extend(Job.selectBy(package=cpackage, dist=job.dist, arch=job.arch))
                        for cjob in candidate_jobs:
                            if newjob and newjob != cjob and cjob.status == JobStatus.WAIT:
                                cjob.status = JobStatus.GIVEUP
                            elif cjob.status == JobStatus.WAIT:
                                newjob = cjob

                    job = newjob

                # We have to check because it might have changed
                # between our first select and the build_more_recent stuffs

                if not job or job.status != JobStatus.WAIT:
                    continue

		# Check dependencies
		if not job.is_allowed_to_build():
		    continue

                job.status = JobStatus.WAIT_LOCKED
                job.host = socket.gethostname()
                self.jobs.append(job)
                count_new += 1
                count_current += 1

                if count_current >= max_new:
                    break

        return count_new
开发者ID:kryskool,项目名称:rebuildd,代码行数:58,代码来源:Rebuildd.py

示例13: __init__

 def __init__(self,orderID, MAid, SPid, PPOSid, qty, minQty, origWeek, future):
     Job.__init__(self, id=MAid)
     self.type = 'item'
     self.orderID = orderID
     self.MAid = MAid
     self.SPid = SPid
     self.PPOSid = PPOSid
     self.qty = qty
     self.minQty = minQty
     self.originalWeek = origWeek
     self.future = future        # if 1 suggests that the MA belongs to the future demand (0 for the PPOS to be disaggregated)
     self.weekPlan = self.originalWeek
开发者ID:Kodextor,项目名称:dream,代码行数:12,代码来源:JobMA.py

示例14: requeue_job

    def requeue_job(self, job_id):
        """Requeue a failed job"""

        if Job.selectBy(id=job_id).count() == 0:
            RebuilddLog.error("There is no job related to %s that is in the job list" % job_id)
            return False
        job = Job.selectBy(id=job_id)[0]

        if job.status in FailedStatus:
            job.status = JobStatus.WAIT
            job.host = ""

        return True
开发者ID:gpocentek,项目名称:rebuildd,代码行数:13,代码来源:Rebuildd.py

示例15: GET_buildstats

    def GET_buildstats(self, distarch=None):
        graph = self.graph_init()
        if distarch == "/":
            graph.title = "Build status"
            jobs = Job.selectBy()
        else:
            dindex = distarch.rindex("/")
            graph.title = "Build status for %s" % distarch[1:]
            jobs = Job.selectBy(arch=distarch[dindex+1:], dist=distarch[1:dindex])

        graph.setData(self.compute_stats(jobs))
        tmp = tempfile.TemporaryFile()
        graph.draw(tmp)
        tmp.seek(0)
        return tmp.read()
开发者ID:kickstandproject,项目名称:rebuildd,代码行数:15,代码来源:RebuilddHTTPServer.py


注:本文中的Job.Job类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。