AthenaApp.
More...
|
def | __init__ (self, cmdlineargs=None, dump_jobo=None) |
|
def | include (self, jobo_name) |
|
def | __lshift__ (self, o) |
|
def | run (self, stdout=None, env=None) |
|
AthenaApp.
another way at scripting `athena`
Definition at line 265 of file ChapPy.py.
◆ __init__()
def python.ChapPy.AthenaApp.__init__ |
( |
|
self, |
|
|
|
cmdlineargs = None , |
|
|
|
dump_jobo = None |
|
) |
| |
Definition at line 269 of file ChapPy.py.
269 def __init__(self, cmdlineargs=None, dump_jobo=None):
272 self._jobo = open (dump_jobo,
'w+')
273 self._jobo_name = dump_jobo
276 self._jobo = tempfile.NamedTemporaryFile(suffix=
'-jobo.py', mode=
'w+')
277 self._jobo_name = self._jobo.name
278 if cmdlineargs
is None:
280 if isinstance(cmdlineargs, str):
281 cmdlineargs = cmdlineargs.split()
282 self._cmdlineargs = cmdlineargs[:]
◆ __lshift__()
def python.ChapPy.AthenaApp.__lshift__ |
( |
|
self, |
|
|
|
o |
|
) |
| |
Definition at line 290 of file ChapPy.py.
290 def __lshift__(self, o):
291 if isinstance(o, str):
293 self._jobo.
write(textwrap.dedent(o))
296 raise TypeError(
'unexpected type %s'%
type(o))
◆ include()
def python.ChapPy.AthenaApp.include |
( |
|
self, |
|
|
|
jobo_name |
|
) |
| |
Definition at line 286 of file ChapPy.py.
287 self._jobo.
write(
'include("%s")\n'%jobo_name)
◆ run()
def python.ChapPy.AthenaApp.run |
( |
|
self, |
|
|
|
stdout = None , |
|
|
|
env = None |
|
) |
| |
Definition at line 298 of file ChapPy.py.
298 def run(self, stdout=None, env=None):
300 import subprocess
as sub
303 athena_exe = sub.Popen([
'which',
'athena.py'],
305 env=env).communicate()[0].strip()
307 athena_exe = os.path.expanduser(os.path.expandvars(athena_exe))
308 athena_exe = os.path.realpath(athena_exe)
309 athena_exe = os.path.abspath(athena_exe)
313 if stdout == os.devnull:
314 stdout =
open(os.devnull,
'w')
315 cmd = [athena_exe] + self._cmdlineargs + [self._jobo_name]
◆ _cmdlineargs
python.ChapPy.AthenaApp._cmdlineargs |
|
private |
◆ _jobo
python.ChapPy.AthenaApp._jobo |
|
private |
◆ _jobo_name
python.ChapPy.AthenaApp._jobo_name |
|
private |
The documentation for this class was generated from the following file: