def runTrackerArguments_fillDefaults(options): coreJsonDb = fp.getCoreFileName(options.jsonDbFile); if (options.logFile is None): options.logFile = fp.getFileNameParts(options.jsonDbFile)\ .getFilePathWithTransformation(lambda x: "log_"+x, extension=".txt"); if (options.jobName is None): options.jobName = coreJsonDb;
def __init__(self, val, argumentName, sep="+"): import fileProcessing as fp super(ArrOfFileNamesArgument, self).__init__(val, argumentName, sep, toStringFunc=lambda x: fp.getCoreFileName(x))
def transform(self): import fileProcessing as fp return self.argNamePrefix() + fp.getCoreFileName(self.val)
raise Exception("Please set environment variable UTIL_SCRIPTS_DIR"); sys.path.insert(0,scriptsDir); import pathSetter; import fileProcessing as fp; import util; import argparse; def writeFileAndEmailWhenDone(args): fileHandle = fp.getFileHandle(args.shPath, 'w'); fileHandle.write(" ".join(args.args)); fileHandle.close(); os.system("bash "+args.shPath); util.sendEmail(args.email, '*****@*****.**', "Done "+args.shPath, ""); if (args.dontRm == False): os.system("rm "+args.shPath); if __name__ == "__main__": parser = argparse.ArgumentParser(description="Generate a shell script that is then launched and an email is sent when done"); parser.add_argument('--shPath', help="The path of the .sh file. Defaults to temp.sh"); parser.add_argument('--email', default='*****@*****.**'); parser.add_argument('args', nargs=argparse.REMAINDER, help="The command that you are actuall submitting through the shell script"); parser.add_argument('--dontRm', action='store_true', help='Wont remove file when done'); args = parser.parse_args(); if (len(args.args) < 1): parser.print_help(); sys.exit(1); if (args.shPath is None): args.shPath = fp.getCoreFileName(args.args[0])+".shTempFile"; writeFileAndEmailWhenDone(args);