예제 #1
0
def _get_job_selector_and_task(config, job_selector_str, require_task):
	if not require_task:
		try:  # try to build job selector without task
			return (None, JobSelector.create(job_selector_str))
		except Exception:
			if not except_nested(TaskNeededException, get_current_exception()):
				raise
			clear_current_exception()
	task = gc_create_workflow(config).task
	return (task, JobSelector.create(job_selector_str, task=task))
예제 #2
0
    def __init__(self, workdir, outdir, currentdir):  # , xml_base, n_xml):
        gridconfig = gridconfig_base
        with open("temp.conf", 'w') as file_:
            file_.write(gridconfig)
        print "grid-control config was written, starting grid-control..."

        if 'Settings' in locals():
            raise Exception(
                'This file is supposed to be run directly by python - not by go.py!'
            )
        try:
            from grid_control_api import gc_create_config, gc_create_workflow
        except ImportError:
            raise Exception(
                'grid-control is not correctly installed ' +
                'or the gc package directory is not part of the PYTHONPATH.')
        from grid_control.utils import abort

        gcconfig = gc_create_config(
            config_file="temp.conf",
            config_dict={
                'global': {
                    'workdir':
                    '/nfs/dust/cms/user/garbersc/forBaconJets/workdirs/' +
                    workdir
                },
                'UserTask': {
                    'dataset': currentdir + "/" + workdir + "/*.xml"
                },
                'storage': {
                    'se path': outdir + "/" + workdir,
                }
            })
        workflow = gc_create_workflow(gcconfig)
        workflow.run()
        abort(False)
        print "grid-control was closed"
예제 #3
0
#!/usr/bin/env python

import logging

# Throw exceptions if the file is executed in the wrong way or grid-control is incorrectly installed
if 'Settings' in locals():
	raise Exception('This file is supposed to be run directly by python - not by go.py!')
try:
	from grid_control_api import gc_create_config, gc_create_workflow
	from grid_control_settings import Settings
except ImportError:
	raise Exception('grid-control is not correctly installed ' +
		'or the gc package directory is not part of the PYTHONPATH.')

setup = Settings()
setup.Global.report = 'null'
setup.Global.backend = 'Host'
setup.Global.task = 'UserTask'
setup.Global.duration = -1
setup.jobs.jobs = 1
setup.jobs.wall_time = 1
setup.task.executable = 'Example02_local.sh'
setup.interactive.default = False

config = gc_create_config(config_dict=setup.get_config_dict())
logging.getLogger().setLevel(logging.CRITICAL)
logging.getLogger('jobs').setLevel(logging.INFO)
workflow = gc_create_workflow(config)
workflow.run()
예제 #4
0
        'This file is supposed to be run directly by python - not by go.py!')
try:
    from grid_control_api import gc_create_config, gc_create_workflow
except ImportError:  # .. or if grid-control is incorrectly installed
    raise Exception(
        'grid-control is not correctly installed ' +
        'or the gc package directory is not part of the PYTHONPATH.')

# Setup workflow
config = gc_create_config(
    config_dict={
        'interactive': {
            'default': False
        },
        'global': {
            'backend': 'Host',
            'task': 'UserTask'
        },
        'task': {
            'executable': 'Example02_local.sh'
        },
        'jobs': {
            'wall time': '1:00',
            'jobs': 2
        },
    })

# Create and run workflow with GUI output
workflow = gc_create_workflow(config)
workflow.run(duration=-1)