Skip to content
Snippets Groups Projects
Commit 021a59b6 authored by Federico Stagni's avatar Federico Stagni
Browse files

added script to test interaction with DIRAC environment

parent 72932cb3
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,8 @@ class UserJobTestCase( IntegrationTest ):
super( UserJobTestCase, self ).setUp()
self.dLHCb = DiracLHCb()
self.exeScriptLocation = find_all( 'exe-script.py', '..', 'Integration' )[0]
self.exeScriptLocation = find_all( 'exe-script.py', '.', 'Integration' )[0]
self.exeScriptFromDIRACLocation = find_all( 'exe-script-fromDIRAC.py', '.', 'Integration' )[0]
self.lhcbJobTemplate = LHCbJob()
self.lhcbJobTemplate.setLogLevel( 'DEBUG' )
self.lhcbJobTemplate.setInputSandbox( find_all( 'pilot.cfg', '..' )[0] )
......@@ -100,6 +101,17 @@ class HelloWorldSuccessOutputWithJobID( UserJobTestCase ):
del os.environ['JOBID']
class HelloWorldFromDIRACSuccess( UserJobTestCase ):
""" Simple hello world (but using DIRAC gLogger)
"""
def test_Integration_User( self ):
oJob = copy.deepcopy( self.lhcbJobTemplate )
oJob.setName( "helloWorldFROMDIRAC-test" )
oJob.setExecutable( self.exeScriptFromDIRACLocation )
res = oJob.runLocal( self.dLHCb )
self.assertTrue( res['OK'] )
class GaudirunSuccess( UserJobTestCase ):
def test_Integration_User_mc( self ):
""" A MC production job, run as a user job
......
#!/usr/bin/env python
'''Script to run Executable application'''
import os
print "This is the environment in which I am running"
print os.environ
print "Now I will try importing DIRAC"
import DIRAC
from DIRAC import gLogger
gLogger.always("Hello hello!")
from DIRAC.Core.Base.Script import parseCommandLine
parseCommandLine()
from DIRAC import gConfig
setup = gConfig.getValue('/DIRAC/Setup')
gLogger.always("I am running on setup %s" % setup)
#!/usr/bin/env python
'''Script to run Executable application'''
from os import system
import sys
from os import system
# Main
if __name__ == '__main__':
sys.exit(system('''echo Hello World''')/256)
sys.exit(system('''echo Hello World''')/256)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment