def test_job_input_to_job(self): job_input = workload_parser.JobInput(SAMPLE_JOB_INPUT[0]) from prototype import _job_input_to_job job = _job_input_to_job(job_input, job_input.num_requested_processors) self.assertEqual( job.id, job_input.number ) self.assertEqual( job.user_estimated_run_time, job_input.requested_time ) self.assertEqual( job.actual_run_time, job_input.run_time ) self.assertEqual( job.num_required_processors, job_input.num_requested_processors )
def test_job_input_to_job(self): job_input = workload_parser.JobInput(SAMPLE_JOB_INPUT[0]) from prototype import _job_input_to_job job = _job_input_to_job(job_input, job_input.num_requested_processors) self.assertEqual(job.id, job_input.number) self.assertEqual(job.user_estimated_run_time, job_input.requested_time) self.assertEqual(job.actual_run_time, job_input.run_time) self.assertEqual(job.num_required_processors, job_input.num_requested_processors)
#!/usr/bin/env python2.4 # receives swf input on stdin, prints it back to stdout minus the lines that # raise asserts in the simulator import fileinput import workload_parser import prototype import sys from prototype import _job_input_to_job for line in fileinput.input(): if line.lstrip().startswith(';'): sys.stdout.write(line) else: job_input = workload_parser.JobInput(line) try: job = _job_input_to_job(job_input) except AssertionError: continue sys.stdout.write(line)