Esempio n. 1
0
 def test_im(self):
     reset_lease_id_counter()  
     self.start()
     cmd = rpc.haizea_request_lease(["-D", "-t", "now", "-d", "00:10:00", "-n", "1", "--non-preemptible", 
                                     "-c", "1", "-m", "512", "-i", "foobar.img", "-z", "600"])
     cmd.run()
     time.sleep(5)
     cmd = rpc.haizea_list_leases(["-D"])
     cmd.run()
     cmd = rpc.haizea_cancel_lease(["-D", "-l", "1"])
     cmd.run()
     cmd = rpc.haizea_list_leases(["-D"])
     cmd.run()
     self.stop()
Esempio n. 2
0
 def test_be(self):
     reset_lease_id_counter()        
     self.start()
     cmd = rpc.haizea_request_lease(["-D", "-t", "best_effort", "-d", "00:10:00", "-n", "4", "--non-preemptible", 
                                     "-c", "1", "-m", "512", "-i", "foobar.img", "-z", "600"])
     cmd.run()
     cmd = rpc.haizea_request_lease(["-D", "-t", "best_effort", "-d", "00:10:00", "-n", "4", "--non-preemptible", 
                                     "-c", "1", "-m", "512", "-i", "foobar.img", "-z", "600"])
     cmd.run()
     time.sleep(7)
     cmd = rpc.haizea_list_leases(["-D"])
     cmd.run()
     # Cancel the queued request
     cmd = rpc.haizea_cancel_lease(["-D", "-l", "2"])
     cmd.run()
     cmd = rpc.haizea_list_leases(["-D"])
     cmd.run()
     # Cancel the running request
     cmd = rpc.haizea_cancel_lease(["-D", "-l", "1"])
     cmd.run()
     cmd = rpc.haizea_list_leases(["-D"])
     cmd.run()
     self.stop()
Esempio n. 3
0
def test_annotation1():
    reset_lease_id_counter()
    lease_workload = LeaseWorkload.from_xml_file("preemption.lwf")
    annotations = LeaseAnnotations.from_xml_file("annotations1.lwfa")
    leases = lease_workload.get_leases()

    annotations.apply_to_leases(leases)

    lease1 = leases[0]
    lease2 = leases[1]

    assert lease1.start.requested == DateTime(0, 1, 1, 10)
    assert lease1.deadline == DateTime(0, 1, 1, 20)
    assert isinstance(lease1.software, UnmanagedSoftwareEnvironment)
    assert lease1.extras["one"] == "1"
    assert lease1.extras["two"] == "2"
        
    assert lease2.start.requested == Timestamp.UNSPECIFIED
    assert lease2.deadline == None
    assert isinstance(lease2.software, DiskImageSoftwareEnvironment)
    assert lease2.software.image_id == "annotation.img"
    assert lease2.software.image_size == 4096
    assert lease2.extras["three"] == "3"
    assert lease2.extras["four"] == "4"
Esempio n. 4
0
def load_tracefile(config, tracefile):
    config.set("tracefile", "tracefile", tracefile)
    Manager.reset_singleton()
    reset_lease_id_counter()
    return Manager(HaizeaConfig(config))