def test_to_json(self): prof_json = BatsimJobProfileAPI.get_delay(10) profile = DelayJobProfile("p", 10) jsn = BatsimRequestAPI.get_register_profile(10, "w", "p", prof_json) r = RegisterProfileBatsimRequest(10, "w", profile) assert r.to_json() == jsn
def test_request(self): p = DelayJobProfile("p", 10) r = RegisterProfileBatsimRequest(10, "w", p) assert r.timestamp == 10 assert r.type == BatsimRequestType.REGISTER_PROFILE assert r.workload_name == "w" assert r.profile == p
def start_job_rejected(name: str, alloc: Sequence[int], sub_t: int, walltime: Optional[int] = None) -> Job: job = Job(name, "w", len(alloc), DelayJobProfile("a", 10), sub_t, walltime) job._submit(sub_t) job._reject() return job
def test_to_json(self): j = Job("n", "w", 1, DelayJobProfile("p", 10), 10.1, 10, 1) jsn = BatsimRequestAPI.get_register_job(10, j.name, j.workload, j.profile.name, j.res, j.walltime, user_id=j.user_id) r = RegisterJobBatsimRequest(10, j) assert r.to_json() == jsn
def start_job_killed(name: str, alloc: Sequence[int], sub_t: int, start_t: int, stop_t: int, walltime: Optional[int] = None) -> Job: job = Job(name, "w", len(alloc), DelayJobProfile("a", 10), sub_t, walltime) job._submit(sub_t) job._allocate(alloc) job._start(start_t) job._terminate(stop_t, JobState.COMPLETED_KILLED) return job
def test_profile_to_json_delay(self): api = BatsimJobProfileAPI.get_delay(10) p = DelayJobProfile("p", 10) jsn = Converters.profile_to_json(p) assert api == jsn
def test_request(self): j = Job("n", "w", 1, DelayJobProfile("p", 10), 10.1, 10, 1) r = RegisterJobBatsimRequest(10, j) assert r.timestamp == 10 assert r.type == BatsimRequestType.REGISTER_JOB assert r.job == j