def transfer_test(args, parser): """transfer test command The transfer test command can be used to verify transfers are functional between the cluster and remote Globus endpoints. The tasks performed: * Perform ls on /~/ on cluster endpoint * Perform ls on /~/ on remote endpoint * Transfer a test file from cluster endpoint to remote endpoint * Display task and wait 2 minutes for task to complete """ _fail = False emop_transfer = EmopTransfer(args.config_path) status = emop_transfer.check_endpoints() if not status: sys.exit(1) # ls_test_path = '/~/' # print("Testing ls ability of %s:%s" % (emop_transfer.cluster_endpoint, ls_test_path)) # cluster_ls_data = emop_transfer.ls(emop_transfer.cluster_endpoint, ls_test_path) # if not cluster_ls_data: # print("ERROR: ls of %s:%s" % (emop_transfer.cluster_endpoint, ls_test_path)) # _fail = True # print("Testing ls ability of %s:%s" % (emop_transfer.remote_endpoint, ls_test_path)) # remote_ls_data = emop_transfer.ls(emop_transfer.remote_endpoint, ls_test_path) # if not remote_ls_data: # print("ERROR: ls of %s:%s" % (emop_transfer.remote_endpoint, ls_test_path)) # _fail = True # # if _fail: # sys.exit(1) print("Generating test files") test_input = "~/test-in.txt" test_output = "~/test-out.txt" test_input_path = os.path.expanduser(test_input) test_file = open(test_input_path, "w+") test_file.write("TEST") test_file.close() transfer_data = [{"src": test_input, "dest": test_output}] task_id = emop_transfer.start(src=emop_transfer.cluster_endpoint, dest=emop_transfer.remote_endpoint, data=transfer_data, label="emop-test", wait=args.wait) emop_transfer.display_task(task_id=task_id, wait=120)
def transfer_status(args, parser): """ transfer status command When no arguments are given this command will simply verify that both cluster and remote Globus endpoints are activated and usable. When the --task-id argument is passed this command will query the status of a Globus transfer task. The --wait argument can be used to force this command to wait for the Globus transfer status to be SUCCEEDED or FAILED. """ emop_transfer = EmopTransfer(args.config_path) if args.task_id: status = emop_transfer.display_task(task_id=args.task_id, wait=args.wait) else: status = emop_transfer.check_endpoints() if status: sys.exit(0) else: sys.exit(1)