def store_output(args, socketed=False, socket_config=""): # Copy stuff to grid storage, remove executable and lhapdf folder # Core files can be upwards of 6G - make sure they're deleted! os.system("rm core*") if not args.use_cvmfs_lhapdf: gf.do_shell("rm -rf {0} {1}".format(args.executable, args.lhapdf_local)) if args.Production: local_out = output_name(args.runcard, args.runname, args.seed) output_file = os.path.join(args.output_folder, args.runname, local_out) elif args.Warmup: local_out = warmup_name(args.runcard, args.runname) output_file = os.path.join(args.warmup_folder, local_out) tar_status = gf.tar_this(local_out, "*") if gf.DEBUG_LEVEL > 1: gf.do_shell("ls") if socketed: # Avoid conflicting simultaneous copies and resulting error messages: # - first node attempts copy to warmup_name(...); # - other nodes attempt copy to warmup_name_ns(...) as backup. # Still results in large redundancy. socket_no = int(socket_config.split()[-1].strip()) if socket_no == 1: status_copy = gf.copy_to_grid(local_out, output_file, args) else: subfolder = os.path.splitext(os.path.basename(output_file))[ 0].replace(".tar", "") backup_name = warmup_name_ns(args.runcard, args.runname, socket_no) backup_fullpath = os.path.join( args.warmup_folder, subfolder, backup_name) status_copy = gf.copy_to_grid(local_out, backup_fullpath, args) else: status_copy = gf.copy_to_grid(local_out, output_file, args) return status_copy, tar_status
download_time = datetime.datetime.now() status += run_sherpa(args) if status != 0: gf.print_flush("Sherpa failed") gf.end_program(status) run_time = datetime.datetime.now() gf.print_file("setup time: "+str(setup_time-start_time)) gf.print_file("download time: "+str(download_time-setup_time)) gf.print_file("Sherpa time: "+str(run_time-download_time)) local_out = output_name(args.runcard, args.runname, args.seed) status += gf.tar_this(local_out, "*.yoda *.log *.dat") output_file = args.output_folder + "/" + local_out status += gf.copy_to_grid(local_out, output_file, args) if gf.DEBUG_LEVEL > 1: gf.do_shell("ls") if status == 0: gf.print_flush("Copied over to grid storage!") tarcopy_time = datetime.datetime.now() gf.print_file("tar© time: "+str(tarcopy_time-run_time)) gf.print_file("total time: "+str(tarcopy_time-setup_time)) gf.end_program(status)
status += run_example(args) if status != 0: gf.print_flush("Executable failed") gf.end_program(status) run_time = datetime.datetime.now() local_out = output_name(args.runcard, args.runname, args.seed) output_file = args.output_folder + "/" + local_out gf.print_file("setup time: " + str(setup_time - start_time)) gf.print_file("download time: " + str(download_time - setup_time)) gf.print_file("total runtime: " + str(run_time - download_time)) status += gf.tar_this(local_out, "*.log *.out {rc}".format(rc=args.runname)) status += gf.copy_to_grid(local_out, output_file, args) if gf.DEBUG_LEVEL > 1: gf.do_shell("ls") if status == 0: gf.print_flush("Copied over to grid storage!") tarcopy_time = datetime.datetime.now() gf.print_file("tar© time: " + str(tarcopy_time - run_time)) gf.print_file("total time: " + str(tarcopy_time - setup_time)) gf.end_program(status)
if status != 0: gf.print_flush("Executable failed") gf.end_program(status) run_time = datetime.datetime.now() local_out = output_name(args.runcard, args.runname, args.seed) print(local_out) output_file = args.output_folder + "/" + local_out print(output_file) gf.print_file("setup time: " + str(setup_time - start_time)) gf.print_file("download time: " + str(download_time - setup_time)) gf.print_file("total runtime: " + str(run_time - download_time)) status += gf.tar_this(local_out, "*.log {rc}/results".format(rc=args.runname)) status += gf.copy_to_grid(local_out, output_file, args) deactivate_environment(args) if gf.DEBUG_LEVEL > 1: gf.do_shell("ls") if status == 0: gf.print_flush("Copied over to grid storage!") tarcopy_time = datetime.datetime.now() gf.print_file("tar© time: " + str(tarcopy_time - run_time)) gf.print_file("total time: " + str(tarcopy_time - setup_time)) gf.end_program(status)