Exemplo n.º 1
0
def prepareOstapRun(version,
                    script='',
                    path='$HOME/cmtuser',
                    use_tmp=False,
                    project='Bender',
                    **kwargs):
    """Prepare OstapRun application
    - specify the script 
    >>> j = Job ( application = prepareOstapRun ( 'v30r1' , script = 'the_path/the_script.py') ) 
    - specify the scripts 
    >>> j = Job ( application = prepareOstapRun ( 'v30r1' , scripts = ['the_path/the_script.py' , 'another_script.py' ] ) ) 
    - specify the directory explicitely:
    >>> j = Job ( application = prepareOstapRun ( 'v30r1' , path = '$HOME/mydir' , script = 'the_script.py' ) 
    - use the temporary directory 
    >>> j = Job ( application = prepareOstapRun ( 'v30r1' , use_tmp = True , script = 'the_script.py' )
    - one can also use the configuration parameters:
    >>> j = Job ( application = prepareOstapRun ( 'v30r1' , script = 'the_path/the_script.py' , commands = [] , imports = []  ) ) 
    - use another project  ('Analysis' is minimal one...)
    >>> j = Job ( application = prepareOstapRun ( project = 'Analysis' , version = 'v18r0' , script = 'the_path/the_script.py' , commands = []  ) ) 
    """
    if use_tmp or not path:
        path = tempfile.mkdtemp(prefix='GANGA_')
        logger.info(
            'Bender application will be prepared in the temporary directory %s'
            % path)

    the_path = prepare_cmake_app(project, version, path)
    #
    scripts = kwarsg.pop('scripts', [])
    if script: scripts.append(script)
    #
    from Ganga.GPI import OstapRun as _OR  ## black magic
    return _OR(scripts=scripts, directory=the_path, **kwargs)
Exemplo n.º 2
0
def prepareOstapRun ( version , script = '' , path = '$HOME/cmtuser', use_tmp = False , project = 'Bender' , **kwargs ) :
    """Prepare OstapRun application
    - specify the script 
    >>> j = Job ( application = prepareOstapRun ( 'v30r1' , script = 'the_path/the_script.py') ) 
    - specify the scripts 
    >>> j = Job ( application = prepareOstapRun ( 'v30r1' , scripts = ['the_path/the_script.py' , 'another_script.py' ] ) ) 
    - specify the directory explicitely:
    >>> j = Job ( application = prepareOstapRun ( 'v30r1' , path = '$HOME/mydir' , script = 'the_script.py' ) 
    - use the temporary directory 
    >>> j = Job ( application = prepareOstapRun ( 'v30r1' , use_tmp = True , script = 'the_script.py' )
    - one can also use the configuration parameters:
    >>> j = Job ( application = prepareOstapRun ( 'v30r1' , script = 'the_path/the_script.py' , commands = [] , imports = []  ) ) 
    - use another project  ('Analysis' is minimal one...)
    >>> j = Job ( application = prepareOstapRun ( project = 'Analysis' , version = 'v18r0' , script = 'the_path/the_script.py' , commands = []  ) ) 
    """
    if use_tmp or not path :
        path = tempfile.mkdtemp ( prefix = 'GANGA_' )
        logger.info ( 'Bender application will be prepared in the temporary directory %s' % path )
        
    the_path = prepare_cmake_app ( project , version , path )
    #
    scripts = kwarsg.pop('scripts', [] )
    if script : scripts.append ( script )
    #
    from Ganga.GPI import OstapRun as _OR  ## black magic    
    return _OR ( scripts = scripts , directory = the_path , **kwargs )
Exemplo n.º 3
0
def prepareBender ( version , module , path = '$HOME/cmtuser', use_tmp = False , **kwargs ) :
    """Prepare Bender application
    - specify the path:
    >>> j = Job ( application = prepareBender ( 'v30r1' , module = 'the_path/the_module.py' , path = '$HOME/cmtuser' ) ) 
    - use the temporary directory 
    >>> j = Job ( application = prepareBender ( 'v30r1' , module = 'the_path/the_modue.py' , use_tmp = True  ) ) 
    - other parameters  can be added as keyword arguments 
    >>> j = Job ( application = prepareBender ( 'v30r1' , module = 'the_path/the_modue.py' , use_tmp = True , params = {} , events = 100 ) ) 
    """
    if use_tmp or not path :
        path = tempfile.mkdtemp ( prefix = 'GANGA_' )
        logger.info ( 'Bender application will be prepared in the temporary directory %s' % path )
        
    the_path = prepare_cmake_app ( 'Bender' , version , path )
    
    from Ganga.GPI import BenderModule as _BM  ## black magic
    return _BM ( module = module , directory = the_path , **kwargs )
Exemplo n.º 4
0
def prepareBender(version,
                  module,
                  path='$HOME/cmtuser',
                  use_tmp=False,
                  **kwargs):
    """Prepare Bender application
    - specify the path:
    >>> j = Job ( application = prepareBender ( 'v30r1' , module = 'the_path/the_module.py' , path = '$HOME/cmtuser' ) ) 
    - use the temporary directory 
    >>> j = Job ( application = prepareBender ( 'v30r1' , module = 'the_path/the_modue.py' , use_tmp = True  ) ) 
    - other parameters  can be added as keyword arguments 
    >>> j = Job ( application = prepareBender ( 'v30r1' , module = 'the_path/the_modue.py' , use_tmp = True , params = {} , events = 100 ) ) 
    """
    if use_tmp or not path:
        path = tempfile.mkdtemp(prefix='GANGA_')
        logger.info(
            'Bender application will be prepared in the temporary directory %s'
            % path)

    the_path = prepare_cmake_app('Bender', version, path)

    from Ganga.GPI import BenderModule as _BM  ## black magic
    return _BM(module=module, directory=the_path, **kwargs)