Lines Matching refs:job
5 """Extra functions for frontend.afe.models.Job objects.
13 It's not really a good idea to define these on the Job class either;
14 they are specialized and the Job class already suffers from method
30 def is_hostless(job):
31 """Return True if the job is hostless.
33 @param job: frontend.afe.models.Job instance
35 return not hostnames(job)
38 def hostnames(job):
39 """Return a list of hostnames for a job.
41 @param job: frontend.afe.models.Job instance
43 hqes = job.hostqueueentry_set.all().prefetch_related('host')
47 def is_aborted(job):
48 """Return if the job is aborted.
50 (This means the job is marked for abortion; the job can still be
53 @param job: frontend.afe.models.Job instance
55 return job.hostqueueentry_set.filter(aborted=True).exists()
58 def is_server_job(job):
59 """Return whether the job is a server job.
61 @param job: frontend.afe.models.Job instance
63 return not is_client_job(job)
66 def is_client_job(job):
67 """Return whether the job is a client job.
69 If the job is not a client job, it is a server job.
71 (In theory a job can be neither. I have no idea what you should do
74 @param job: frontend.afe.models.Job instance
77 return CONTROL_TYPE.get_value(job.control_type) == CONTROL_TYPE.CLIENT
80 def needs_ssp(job):
81 """Return whether the job needs SSP.
86 @param job: frontend.afe.models.Job instance
89 and is_server_job(job)
91 and job.require_ssp != False)
103 """Path to control file for a job.
121 def prepare_control_file(job, workdir):
122 """Prepare control file for a job."""
124 f.write(job.control_file)
127 def prepare_keyvals_files(job, workdir):
128 """Prepare Autotest keyvals files for a job."""
129 keyvals = job.keyval_dict()
131 int(time.mktime(job.created_on.timetuple()))
133 if is_hostless(job):
135 for hqe in job.hostqueueentry_set.all().prefetch_related('host'):
140 def write_aborted_keyvals_and_status(job, workdir):
141 """Write the keyvals and status for an aborted job."""
144 for hqe in job.hostqueueentry_set.all():
156 workdir, 'Job aborted by %s on %s' % (aborted_by, aborted_on))