コード例 #1
0
def submit_job(job_name, zip_name, backend):
    """
    Allows a user non-interactively submit a job (eg from a script)
    :param job_name: The name of the job (to be shown in DIRAC)
    :param zip_name: The path to the zip file
    :param backend: The backend to run, local or grid
    """

    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
    j.application = Executable()
    j.application.exe = File('run_analyse.sh')

    if backend == "grid":
        grid_backend(j, zip_name)
    else:
        local_backend(j, zip_name)
    j.submit()
コード例 #2
0
ファイル: run.py プロジェクト: willfurnell/grid-analysis
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()
コード例 #3
0
def submit_job_interactive():
    """
    Allow a user to interactively submit a job, either locally or on GridPP.
    This will check that their input is valid and submit the job.
    """
    job_name = raw_input("Job name? > ")

    foundzip = False

    while foundzip is False:
        zip_name = raw_input(
            "Path to ZIP file? Full path on your system please! > ")
        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:
        print(
            "Note: Choosing the grid backend will automatically upload input to DIRAC storage in your home area for your VO."
        )
        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
    j.application = Executable()
    j.application.exe = File('run_analyse.sh')
    if backend == "grid":
        grid_backend(j, zip_name)
    else:
        local_backend(j, zip_name)

    j.submit()
コード例 #4
0
ファイル: run.py プロジェクト: willfurnell/grid-analysis
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()