Beispiel #1
0
 async def test_job_in_drone(self):
     scheduler = DummyScheduler()
     job = CachingJob(
         resources={
             "walltime": 50,
             "cores": 1,
             "memory": 1
         },
         used_resources={
             "walltime": 10,
             "cores": 1,
             "memory": 1
         },
     )
     drone = Drone(
         scheduler=scheduler,
         pool_resources={
             "cores": 1,
             "memory": 1
         },
         scheduling_duration=0,
         connection=Connection(throughput=1),
     )
     async with Scope() as scope:
         scope.do(drone.run(), volatile=True)
         scope.do(drone.schedule_job(job=job))
         await (scheduler.statistics._available ==
                scheduler.statistics.resource_type(job_succeeded=1))
     assert 10 == time.now
     assert 0 == job.waiting_time
     assert job.successful
Beispiel #2
0
 async def test_nonmatching_job_in_drone(self):
     scheduler = DummyScheduler()
     job = Job(
         resources={
             "walltime": 50,
             "cores": 2,
             "memory": 1
         },
         used_resources={
             "walltime": 10,
             "cores": 1,
             "memory": 1
         },
     )
     drone = Drone(
         scheduler=scheduler,
         pool_resources={
             "cores": 1,
             "memory": 1
         },
         scheduling_duration=0,
     )
     async with Scope() as scope:
         scope.do(drone.run(), volatile=True)
         scope.do(drone.schedule_job(job=job))
         await (scheduler.statistics._available ==
                scheduler.statistics.resource_type(job_failed=1))
     assert 0 == time
     assert not job.successful
     assert 0 == job.waiting_time
Beispiel #3
0
 async def test_two_matching_jobs(self):
     scheduler = DummyScheduler()
     job_one = CachingJob(
         resources={
             "walltime": 50,
             "cores": 1,
             "memory": 1
         },
         used_resources={
             "walltime": 10,
             "cores": 1,
             "memory": 1
         },
     )
     job_two = CachingJob(
         resources={
             "walltime": 50,
             "cores": 1,
             "memory": 1
         },
         used_resources={
             "walltime": 10,
             "cores": 1,
             "memory": 1
         },
     )
     drone = Drone(
         scheduler=scheduler,
         pool_resources={
             "cores": 2,
             "memory": 2
         },
         scheduling_duration=0,
     )
     async with Scope() as scope:
         scope.do(drone.run(), volatile=True)
         scope.do(drone.schedule_job(job=job_one))
         scope.do(drone.schedule_job(job=job_two))
         await (scheduler.statistics._available ==
                scheduler.statistics.resource_type(job_succeeded=2))
     assert 10 == time
     assert job_one.successful
     assert job_two.successful
     assert 0 == job_one.waiting_time
     assert 0 == job_two.waiting_time