Lines Matching refs:job
9 from automation.common import job
22 self.job = job_to_execute
27 self.name = '%s-%s' % (self.__class__.__name__, self.job.id)
30 self._executer = LoggingCommandExecuter(self.job.dry_run)
35 self.job.primary_machine.hostname,
36 self.job.primary_machine.username,
40 raise job.JobFailure(fail_msg, exit_code)
47 raise job.JobFailure(fail_msg, exit_code)
53 self._logger.debug('Cleaning up %r work directory.', self.job)
54 self._RunRemotely(cmd.RmTree(self.job.work_dir), 'Cleanup workdir failed.')
57 self._logger.debug('Cleaning up %r home directory.', self.job)
58 self._RunLocally(cmd.RmTree(self.job.home_dir), 'Cleanup homedir failed.')
62 cmd.MakeDir(self.job.work_dir, self.job.logs_dir, self.job.results_dir),
63 'Creating new job directory failed.')
66 self._executer.OpenLog(os.path.join(self.job.logs_dir,
67 self.job.log_filename_prefix))
70 for dependency in self.job.folder_dependencies:
71 to_folder = os.path.join(self.job.work_dir, dependency.dest)
72 from_folder = os.path.join(dependency.job.work_dir, dependency.src)
73 from_machine = dependency.job.primary_machine
75 if from_machine == self.job.primary_machine and dependency.read_only:
89 command = self.job.GetCommand()
93 cwd=self.job.work_dir)),
95 self.job.timeout)
100 cmd.RemoteCopyFrom(self.job.primary_machine.hostname,
101 self.job.results_dir,
102 self.job.home_dir,
103 username=self.job.primary_machine.username),
107 self.job.status = job.STATUS_SETUP
108 self.job.machines = self.machines
109 self._logger.debug('Executing %r on %r in directory %s.', self.job,
110 self.job.primary_machine.hostname, self.job.work_dir)
117 self.job.status = job.STATUS_COPYING
121 self.job.status = job.STATUS_RUNNING
126 # If we get here, the job succeeded.
127 self.job.status = job.STATUS_SUCCEEDED
128 except job.JobFailure as ex:
129 self._logger.error('Job failed. Exit code %s. %s', ex.exit_code, ex)
131 self._logger.info('%r was killed', self.job)
133 self.job.status = job.STATUS_FAILED
138 listener.NotifyJobComplete(self.job)