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/ Generated automatically from 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/ share/ share/ test/*.py share/ share/ share/ )
atlas_install_scripts( share/ share/ share/ share/ share/ share/ )
atlas_install_scripts( share/ share/ share/ share/ share/ )
# Aliases:
atlas_add_alias( athena-app "" )
atlas_add_alias( athena "" )
atlas_add_test( AthAppMgrUnitTests SCRIPT test/
This diff is collapsed.
#!/usr/bin/env python
# @file AthenaCommon/share/
from __future__ import with_statement
__version__ = "$Revision: 1.2 $"
__author__ = "Sebastien Binet <>"
__doc__ = """a better?"""
#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)'running app.configure(...)')
sc = 0
if options.run_batch:"entering batch mode")
sc =
if options.dbg_stage == "fini":
import AthenaCommon.Debugging as _dbg
# print a stack trace to know something bad happened !
import traceback, sys
# 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
if app.exitstate != ExitCodes.ALL_OK:
# trigger the AthenaSummarySvc...
else:"entering interactive mode")
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 !
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'] + '/'
import string
ldpreload = string.replace( ldpreload, tcmlib, '' )
ldpreload = string.replace( ldpreload, '::', ':')
ldpreload = ldpreload.strip(':')
del tcmlib
if not ldpreload:
del os.environ['LD_PRELOAD']
os.environ['LD_PRELOAD'] = ldpreload
# 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"
dso = os.path.join(tcmalloc_dir, '')
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)
os.environ['LD_PRELOAD'] = dso
# stdcmalloc
# spawn a new process with the correct environment...
import AthenaCommon.Utils.unixtools as uut
exe = uut.FindFile('python',
args= [exe] + sys.argv
#print "---> args:",args
os.execvpe(exe, args, os.environ)
if __name__ == "__main__":
options = _process_cmdline_args()
......@@ -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 instead of', 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 is to be used instead of
# @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 instead of
# @param val A boolean value is expected.
# @see _useAthenaApp attribute.
# @return None
def enableAthenaApp( self, val ):
self._useAthenaApp = val
if val:
trfconsts.athena_py = ''
trfconsts.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