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


Python Job.status方法代码示例

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


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

示例1: test_set_dict

# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import status [as 别名]
    def test_set_dict(self):
        job = Job('test')

        # testing some untested cases in set_dict()
        job.status = Status.ERROR
        assert job.status.css == 'danger', 'status.css should be "danger".'

        job.status = '404'
        assert job.status.css == 'default', 'status.css should be "default".'
开发者ID:chintak,项目名称:DIGITS,代码行数:11,代码来源:test_status.py

示例2: test_set_dict

# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import status [as 别名]
    def test_set_dict(self):
        job = Job(name='testsuite-job', username='digits-testsuite')

        # testing some untested cases in set_dict()
        job.status = Status.ERROR
        assert job.status.css == 'danger', 'status.css should be "danger".'

        job.status = '404'
        assert job.status.css == 'default', 'status.css should be "default".'
开发者ID:GarfieldEr007,项目名称:DIGITS,代码行数:11,代码来源:test_status.py

示例3: test_run_too_soon

# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import status [as 别名]
 def test_run_too_soon(self):
     job = Job('test')
     job.status = Status.WAIT
     job.status = Status.RUN
     # Status.WAIT should be removed so the len should be 2 rather
     # than 3.
     assert len(job.status_history) == 2, 'history length should be 2'
开发者ID:chintak,项目名称:DIGITS,代码行数:9,代码来源:test_status.py

示例4: test_run_too_soon

# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import status [as 别名]
 def test_run_too_soon(self):
     job = Job(name='testsuite-job', username='digits-testsuite')
     job.status = Status.WAIT
     job.status = Status.RUN
     # Status.WAIT should be removed so the len should be 2 rather
     # than 3.
     assert len(job.status_history) == 2, 'history length should be 2'
开发者ID:GarfieldEr007,项目名称:DIGITS,代码行数:9,代码来源:test_status.py

示例5: test_empty_history

# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import status [as 别名]
    def test_empty_history(self):
        job = Job('test')

        job.status = Status.WAIT
        job.status = Status.RUN
        job.status_history = []
        # An empty history should not happen, but if it did, the value
        # should be Status.INIT.
        assert job.status == Status.INIT, 'status should be Status.INIT'
开发者ID:chintak,项目名称:DIGITS,代码行数:11,代码来源:test_status.py

示例6: test_empty_history

# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import status [as 别名]
    def test_empty_history(self):
        job = Job(name='testsuite-job', username='digits-testsuite')

        job.status = Status.WAIT
        job.status = Status.RUN
        job.status_history = []
        # An empty history should not happen, but if it did, the value
        # should be Status.INIT.
        assert job.status == Status.INIT, 'status should be Status.INIT'
开发者ID:GarfieldEr007,项目名称:DIGITS,代码行数:11,代码来源:test_status.py

示例7: grab_new_jobs

# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import status [as 别名]
    def grab_new_jobs (self, connection):
        jobs = []       
        cursor = connection.cursor()
        cursor.execute(self.GRAB_NEW_JOBS_SQL)

        row = cursor.fetchone()
        while row:
            new_job = Job(row[0], connection)
            new_job.status = 2
            new_job.set_status_in_db(connection)
            jobs.append(new_job)
            row = cursor.fetchone()

        return jobs
开发者ID:cplazas,项目名称:church-scripts,代码行数:16,代码来源:cdmaker.py

示例8: generate

# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import status [as 别名]
	def generate(self):
		if self.filenamein != None and self.filenameout != None:
			# Read all the information
			jobs = {}
			attempts = []
			nodes = {}
			power = []
			maxpower = 0.0
			for line in self.filein.readlines():
				if line.startswith('Job'):
					ret = self.getDict(line.split(' ')[1:-1])
					jobId = ret['JOBID']
					if jobId not in jobs:
						jobs[jobId] = Job(jobId=jobId)
					jobs[jobId].status = ret['JOB_STATUS']
					jobs[jobId].submit = int(ret['SUBMIT_TIME'])
					jobs[jobId].start =  int(ret['START_TIME'])
					jobs[jobId].finish = int(ret['FINISH_TIME'])
					'''
					job.nmapsapprox = 0
					job.nredsapprox = 0
					for attempt in attempts:
						if job.jobId == attempt.getJobId():
							if attempt.isMap():
								job.nmaps += 1
								if attempt.approx or attempt.status == Job.Status.DROPPED:
									job.nmapsapprox += 1
							if attempt.isMap():
								job.nreds += 1
								if attempt.approx or attempt.status == Job.Status.DROPPED:
									job.nredsapprox += 1
					job.quality = 1.0 - (1.0*job.nmapsapprox/job.nmaps)
					'''
				elif line.startswith('Task'):
					pass
				elif line.startswith('MapAttempt') or line.startswith('ReduceAttempt'):
					ret = self.getDict(line.split(' ')[1:-1])
					attempt = Attempt()
					attempt.attemptId = ret['TASK_ATTEMPT_ID']
					attempt.start =  int(ret['START_TIME'])
					attempt.finish = int(ret['FINISH_TIME'])
					attempt.approx = (ret['APPROXIMATED'] == 'True' or ret['APPROXIMATED'] == 'true')
					attempt.status = ret['TASK_STATUS']
					attempt.nodeId = ret['HOSTNAME']
					attempts.append(attempt)
					# Update job information
					jobId = attempt.getJobId()
					if jobId not in jobs:
						jobs[jobId] = Job(jobId=jobId)
					jobs[jobId].addAttempt(attempt)
				elif line.startswith('Node'):
					ret = self.getDict(line.split(' ')[1:-1])
					nodeId = ret['HOSTNAME']
					if nodeId not in nodes:
						nodes[nodeId] = []
					nodes[nodeId].append((int(ret['TIME']), ret['STATUS']))
				elif line.startswith('Power'):
					ret = self.getDict(line.split(' ')[1:-1])
					power.append((int(ret['TIME']), float(ret['POWER'])))
					maxpower = max(maxpower, float(ret['POWER']))
			
			# Node -> Attempts
			nodeAttempts = {}
			totalAttemptsApprox = 0
			totalAttemptsDropped = 0
			totalAttemptsPrecise = 0
			for attempt in attempts:
				if attempt.approx:
					totalAttemptsApprox += 1
				if attempt.status == Job.Status.DROPPED:
					totalAttemptsDropped += 1
				if attempt.status != Job.Status.DROPPED and not attempt.approx:
					totalAttemptsPrecise += 1
				if attempt.nodeId not in nodeAttempts:
					nodeAttempts[attempt.nodeId] = []
				nodeAttempts[attempt.nodeId].append(attempt)
			if 'None' in nodeAttempts:
				del nodeAttempts['None']
			
			totalJobTime = 0
			totalJobRunTime = 0
			totalQuality = 0.0
			for jobId in jobs:
				job = jobs[jobId]
				totalJobTime += job.finish - job.submit
				totalJobRunTime += job.finish - job.start
				totalQuality += job.getQuality()
			totalJobTime = totalJobTime/len(jobs)
			totalJobRunTime = totalJobRunTime/len(jobs)
			totalJobQuality = totalQuality/len(jobs)
			
			# Power
			power = sorted(power, key=itemgetter(0))
			totalenergy = 0.0
			for t, p in power:
				totalenergy += p
			totaltime = power[-1][0]
			
			# Generate output HTML
			self.fileout.write('<html>\n')
#.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:103,代码来源:


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