def getInstance(self):
     user = self.getUser()
     inst = Instance.findByName(SESSION, 'test_instance', user)
     dependency_names=[]
     command_dict = {'1': {'dependencies': [], 'command': u"echo 'hello'\r\nsleep 10", 'id': '1', 'name': u'Command 1'}, '2': {'dependencies': ['1'], 'command': u"echo 'hello 2'", 'id': '2', 'name': u'Command 2'}}
     inst = Instance.findByName(SESSION, 'test_instance', user)
     if inst == None:
         inst = Instance('test_instance', "f1-micro", self.getImage(), "us-central1-a", "", 
                         "tag1|tag2", "key1:value1|key2:value2", dependency_names, 
                         [self.getReadDisk()], [self.getReadWriteDisk()], self.getBootDisk(), 
                         command_dict, rootdir="/home/cmelton/", preemptible=True, numLocalSSD=0, 
                         localSSDInitSources="", localSSDDests="")
     return inst
def restartInstance(iid):
    time.sleep(60)
    instance = Instance.findByID(SESSION, iid)
    return instance.restart(SESSION)
def finishInstance(iid):
    instance = Instance.findByID(SESSION, iid)
    instance.finish(SESSION)