Commit 6df23c88 authored by Walter Lampl's avatar Walter Lampl
Browse files

Merge branch 'remove_athena_app' into 'master'

Remove athena-app

See merge request atlas/athena!20012
parents e5da887e eccd63a0
/* AthenaCommon/config.h.in. Generated automatically from configure.in by autoheader. */
......@@ -13,10 +13,9 @@ atlas_depends_on_subdirs( PRIVATE
atlas_install_headers( AthenaCommon )
atlas_install_python_modules( python/*.py python/Utils )
atlas_install_joboptions( share/Preparation.py share/Execution.py share/Atlas.UnixStandardJob.py test/*.py share/Atlas_Gen.UnixStandardJob.py share/MemTraceInclude.py share/runbatch.py )
atlas_install_scripts( share/athena.py share/athena_preload.sh share/athena-app.py share/chappy.py share/find_cfg_dups.py share/test_cfg_pickling.py )
atlas_install_scripts( share/athena.py share/athena_preload.sh share/chappy.py share/find_cfg_dups.py share/test_cfg_pickling.py )
# Aliases:
atlas_add_alias( athena-app "athena-app.py" )
atlas_add_alias( athena "athena.py" )
atlas_add_test( AthAppMgrUnitTests SCRIPT test/test_AthAppMgrUnitTests.sh
......
This diff is collapsed.
#!/usr/bin/env python
# @file AthenaCommon/share/athena-app.py
from __future__ import with_statement
__version__ = "$Revision: 1.2 $"
__author__ = "Sebastien Binet <binet@cern.ch>"
__doc__ = """a better? athena.py"""
#import user
import os
import sys
def main(options):
import sys
import os
import AthenaCommon.ExitCodes as ExitCodes
import AthenaCommon.AthApi as api
app = api.AthApp(options)
api.msg.info('running app.configure(...)')
app.configure(joboptions=options.scripts,
commands=options.command,
extra_options=sys.argv[:])
sc = 0
if options.run_batch:
api.msg.info("entering batch mode")
try:
sc = app.run().isSuccess()
if options.dbg_stage == "fini":
import AthenaCommon.Debugging as _dbg
_dbg.hookDebugger()
except:
# print a stack trace to know something bad happened !
import traceback, sys
traceback.print_exc(file=sys.stderr)
# update the exit-code
if app.exitstate == ExitCodes.ALL_OK:
app.exitstate = ExitCodes.UNKNOWN_EXCEPTION
# re-raise, in case somebody wants to do something about it
raise
finally:
if app.exitstate != ExitCodes.ALL_OK:
# trigger the AthenaSummarySvc...
# FIXME
pass
app.exit()
else:
api.msg.info("entering interactive mode")
api.enter_interactive_loop(app=app)
sc = app.exitstate
return sc
def _process_cmdline_args():
import AthenaCommon.AthOptionsParser as aop
opts = aop.parse(chk_tcmalloc=False)
#-----------------------------------------------------------------
# side-effect: bootstrap ourselves and handle the environment
# changing options (tcmalloc/stdcmalloc -> LD_PRELOAD)
# => we may need to os.execvpe ourselves with the correct new env.
_frozen = os.environ.get('_ATHENA_APP_FROZEN', '0')
os.environ['_ATHENA_APP_FROZEN'] = _frozen
# may not return !
_bootstrap_env(opts)
#-----------------------------------------------------------------
from AthenaCommon.Logging import log as msg
from AthenaCommon.Logging import logging
msg.setLevel(getattr(logging, opts.msg_lvl))
import AthenaCommon.ExitCodes as ExitCodes
if len(opts.scripts)<=0 and opts.run_batch:
msg.error("batch mode requires at least one joboptions")
raise aop.AthOptionsError(reason=ExitCodes.INCLUDE_ERROR)
return opts
def _bootstrap_env(options):
"""helper function to modify the current process environment according
to `options` and os.execvpe.
we set a special environment variable '_ATHENA_APP_FROZEN' to 1 to
prevent infinite recursion.
if we are already a 'frozen' process, perform some clean-up if any
"""
_frozen = os.environ['_ATHENA_APP_FROZEN']
if _frozen == '1':
### remove pre-load hack for proper execution of child-processes ------
ldpreload = os.environ.get('LD_PRELOAD', '')
if ldpreload:
tcmlib = os.environ['TCMALLOCDIR'] + '/libtcmalloc.so'
import string
ldpreload = string.replace( ldpreload, tcmlib, '' )
ldpreload = string.replace( ldpreload, '::', ':')
ldpreload = ldpreload.strip(':')
del tcmlib
if not ldpreload:
del os.environ['LD_PRELOAD']
else:
os.environ['LD_PRELOAD'] = ldpreload
return
# freeze...
os.environ['_ATHENA_APP_FROZEN'] = '1'
if options.use_tcmalloc:
tcmalloc_dir = os.environ.get('TCMALLOCDIR', None)
#dont display the warning if in AthAnalysisBase
if tcmalloc_dir is None and "ManaCore" not in os.environ.get("CMTEXTRATAGS",""):
print "WARNING: $TCMALLOCDIR not defined, will use libc malloc"
else:
dso = os.path.join(tcmalloc_dir, 'libtcmalloc.so')
if not os.path.exists(dso):
raise OSError('library [%s] does not exist' % dso)
ldpreload = os.environ.get('LD_PRELOAD', None)
if ldpreload:
os.environ['LD_PRELOAD'] = os.pathsep.join(
[dso] + ldpreload.split(os.pathsep)
)
else:
os.environ['LD_PRELOAD'] = dso
else:
# stdcmalloc
pass
# spawn a new process with the correct environment...
import AthenaCommon.Utils.unixtools as uut
exe = uut.FindFile('python',
os.environ['PATH'].split(os.pathsep),
os.X_OK)
args= [exe] + sys.argv
#print "---> args:",args
os.execvpe(exe, args, os.environ)
if __name__ == "__main__":
options = _process_cmdline_args()
retcode=main(options)
sys.exit(retcode)
......@@ -211,7 +211,6 @@ class RunOptions(JobConfig):
command = CommandLineOption('c', 'command', 'Python code to be pre-executed before any scripts', True )
mcinput = CommandLineOption('', 'mcinput', 'Monte Carlo input file used. Omit if real data is used. Enabling this option also implies setting --usesqlite=True', True, False, choices = [ True, False ] )
usesqlite = CommandLineOption('', 'usesqlite', 'Force the use of local/symlinked sqlite files rather than ORACLE.', True, False, choices = [ True, False ] )
useathenaapp = CommandLineOption('', 'useathenaapp', 'Force the use of athena-app.py instead of athena.py', True, False, choices = [ True, False ] )
omitvalidation = CommandLineOption('', 'omitvalidation', 'Omit certain validation routines. Use "ALL" to omit all validation routines, use "NONE" to remove all validation ommissions.', True, choices = VALIDATION_DICT.keys() + ['NONE'] )
athenaopts = CommandLineOption('a', 'athenaopts', 'Options to be passed on to athena', True)
argdict = CommandLineOption('', 'argdict', 'Run arguments given in a python dictionary in a pickle file', True)
......
......@@ -48,7 +48,7 @@ class JobTransform(TransformLogger):
_runArgsName = 'runArgs'
## Command line options shared between composite transforms
_sharedRunOpts = [ 'athenaopts', 'ignoreunknown', 'ignoreall', 'ignoreerrors', 'tcmalloc', 'leakcheckexecute', 'rss', 'vmem', 'extrametadatadict', 'extraignorefilters', 'usenewmeta', 'omitvalidation', 'command', 'mcinput', 'usesqlite', 'useathenaapp', 'uploadtoami' ]
_sharedRunOpts = [ 'athenaopts', 'ignoreunknown', 'ignoreall', 'ignoreerrors', 'tcmalloc', 'leakcheckexecute', 'rss', 'vmem', 'extrametadatadict', 'extraignorefilters', 'usenewmeta', 'omitvalidation', 'command', 'mcinput', 'usesqlite', 'uploadtoami' ]
## Options that are also accepted as arguments (via full_trfarg.OptionArg)
_optionArgNames = [ 'athenaopts', 'ignoreunknown', 'ignoreall', 'ignoreerrors', 'tcmalloc', 'leakcheckexecute', 'rss', 'vmem', 'extrametadatadict', 'extraignorefilters', 'usenewmeta', 'omitvalidation', 'command', 'mcinput', 'usesqlite', 'uploadtoami' ]
......@@ -209,9 +209,6 @@ class JobTransform(TransformLogger):
self._useSQLite = None
## Set to true if random throw gives a number smaller than the value of input argument --uploadtoami
self._exportToAmi = False
## True when athena-app.py is to be used instead of athena.py
# @see Set using enableAthenaApp().
self._useAthenaApp = False
## Dictionary of key/values of arguments.
self._namedArgs = {}
## List of arguments in strict order.
......@@ -267,7 +264,6 @@ class JobTransform(TransformLogger):
runOpts.getProperty('command').setActionFunction( self.setPECommand )
runOpts.getProperty('mcinput').setActionFunction( self.enableMCInput )
runOpts.getProperty('usesqlite').setActionFunction( self.enableSQLite )
runOpts.getProperty('useathenaapp').setActionFunction( self.enableAthenaApp )
runOpts.getProperty('ignoreerrors').setActionFunction( self.enableMaskAllErrors )
runOpts.getProperty('ignoreunknown').setActionFunction( self.enableIgnoreUnknownErrors )
runOpts.getProperty('ignoreall').setActionFunction( self.enableIgnoreAllErrors )
......@@ -674,17 +670,6 @@ class JobTransform(TransformLogger):
def enableSQLite( self, val ):
self._useSQLite = val
## Setter function to force the transform to use athena-app.py instead of athena.py
# @param val A boolean value is expected.
# @see _useAthenaApp attribute.
# @return None
def enableAthenaApp( self, val ):
self._useAthenaApp = val
if val:
trfconsts.athena_py = 'athena-app.py'
else:
trfconsts.athena_py = 'athena.py'
## @brief Allow various validation routines to be omitted.
# @param omitStr Valid strings are based on the keys of the trfutil.VALIDATION_DICT dictionary. Multiple values can be comma-delimited (without spaces). Use 'ALL' to omit all validation routines, use 'NONE' to remove all validation ommissions.
# @see trfutil.VALIDATION_DICT dictionary.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment