def submit_job_interactive(): job_name = raw_input("Job name? > ") foundzip = False while foundzip is False: zip_name = raw_input("Path to ZIP file? > ") if not zipfile.is_zipfile(zip_name): # Not a zip file - so need to get them to enter again! print("The file you have supplied is not a zip file!") foundzip = False else: foundzip = True backend_chosen = False while backend_chosen is False: backend_choice = raw_input("Grid backend? [Y/N] > ") if backend_choice.lower() == "y": backend = "grid" backend_chosen = True elif backend_choice.lower() == "n": backend = "local" backend_chosen = True else: backend_chosen = False j = Job() j.name = "grid-analysis_" + job_name # Tell Ganga it's running an executable: analyse.py j.application = Executable() j.application.exe = File('run_analyse.sh') j.application.args = [zip_name] j.inputfiles = [LocalFile('frames.zip'), LocalFile('dscreader.py'), LocalFile('analyse.py')] if backend == "grid": j.outputfiles = [DiracFile('grid-analysis-frames.csv')] j.backend = Dirac() else: j.outputfiles = [LocalFile('grid-analysis-frames.csv')] j.submit()
def submit_job(job_name, zip_name, backend): if not zipfile.is_zipfile(zip_name): # Not a zip file - so need to get them to enter again! print("The file you have supplied is not a zip file!") raise Exception("ZIPFileError", "The ZIP file you supplied is not a ZIP file! Cannot continue.") j = Job() j.name = "grid-analysis_" + job_name # Tell Ganga it's running an executable: analyse.py j.application = Executable() j.application.exe = File('run_analyse.sh') j.application.args = [zip_name] j.inputfiles = [LocalFile('frames.zip'), LocalFile('dscreader.py'), LocalFile('analyse.py')] j.outputfiles = [LocalFile('grid-analysis-frames.csv')] j.submit()