try:
now = time.time()
timeout = now + wait
+ with open(PID_PATH, 'r') as f:
+ server_pid = int(f.read())
while now <= timeout:
- with open(PID_PATH, 'r') as f:
- server_pid = int(f.read())
os.kill(server_pid, signal.SIGTERM) == None
+ os.getpgid(server_pid) # throw OSError if no such pid
now = time.time()
+ time.sleep(0.1)
except IOError:
good_pid = False
except OSError:
test_pid = find_server_pid(pid_file, 0)
if test_pid == None or not reuse_server:
- if test_pid != None:
- stop()
+ # do not try to run both server variants at once
+ stop()
# delete cached discovery document
shutil.rmtree(arvados.http_cache('discovery'))
_start_keep(0)
_start_keep(1)
+
+ os.environ["ARVADOS_API_HOST"] = "127.0.0.1:3001"
+ os.environ["ARVADOS_API_HOST_INSECURE"] = "true"
+
authorize_with("admin")
- api = arvados.api('v1')
- a = api.keep_disks().list().execute()
+ api = arvados.api('v1', cache=False)
+ for d in api.keep_services().list().execute()['items']:
+ api.keep_services().delete(uuid=d['uuid']).execute()
for d in api.keep_disks().list().execute()['items']:
api.keep_disks().delete(uuid=d['uuid']).execute()
- api.keep_disks().create(body={"keep_disk": {"service_host": "localhost", "service_port": 25107} }).execute()
- api.keep_disks().create(body={"keep_disk": {"service_host": "localhost", "service_port": 25108} }).execute()
+ s1 = api.keep_services().create(body={"keep_service": {"service_host": "localhost", "service_port": 25107, "service_type": "disk"} }).execute()
+ s2 = api.keep_services().create(body={"keep_service": {"service_host": "localhost", "service_port": 25108, "service_type": "disk"} }).execute()
+ api.keep_disks().create(body={"keep_disk": {"keep_service_uuid": s1["uuid"] } }).execute()
+ api.keep_disks().create(body={"keep_disk": {"keep_service_uuid": s2["uuid"] } }).execute()
os.chdir(cwd)
'''token is the symbolic name of the token from the api_client_authorizations fixture'''
arvados.config.settings()["ARVADOS_API_TOKEN"] = fixture("api_client_authorizations")[token]["api_token"]
arvados.config.settings()["ARVADOS_API_HOST"] = os.environ.get("ARVADOS_API_HOST")
+ arvados.config.settings()["ARVADOS_API_HOST_INSECURE"] = "true"
if __name__ == "__main__":
parser = argparse.ArgumentParser()
run_keep()
elif args.action == 'stop_keep':
stop_keep()
+ else:
+ print('Unrecognized action "{}", actions are "start", "stop", "start_keep", "stop_keep"'.format(args.action))