ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Generators
GeneratorConfig
scripts
get_generator_info.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
4
from
PyJobTransforms.trfExceptions
import
TransformAMIException
5
from
PyJobTransforms.trfAMI
import
AMIerrorCode, getAMIClient, get_ami_tag
6
7
import
logging
8
msg = logging.getLogger(__name__)
9
10
import
os
11
import
sys
12
tag = sys.argv[1]
13
14
try
:
15
import
pyAMI.exception
16
except
ImportError
as
e:
17
raise
TransformAMIException(AMIerrorCode,
'Import of pyAMI modules failed ({0})'
.format(e))
18
19
try
:
20
amiclient = getAMIClient()
21
result = get_ami_tag(amiclient, tag,
True
)
22
except
pyAMI.exception.Error
as
e:
23
msg.warning(
'An exception occured when connecting to primary AMI: {0}'
.format(e))
24
msg.error(
'Exception: {0}'
.format(e))
25
if
'please login'
in
e.message
or
'certificate expired'
in
e.message:
26
raise
TransformAMIException(AMIerrorCode,
'Getting tag info from AMI failed with credential problem. '
27
'Please check your AMI account status.'
)
28
if
'Invalid amiTag'
in
e.message:
29
raise
TransformAMIException(AMIerrorCode,
'Invalid AMI tag ({0}).'
.format(tag))
30
31
msg.error(
"Error may not be fatal - will try AMI replica catalog"
)
32
33
build, version = result[0][
"SWReleaseCache"
].
split
(
"_"
)
34
print
(build)
35
print
(version)
36
37
folder_path = os.path.dirname(os.path.realpath(__file__))
38
command = f
"{folder_path}/get_generator_versions.sh {build} {version} {tag}"
39
import
subprocess
40
output, error = subprocess.Popen([
"/bin/bash"
,
"-c"
, command], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
41
output, error = output.decode(
"utf-8"
), error.decode(
"utf-8"
)
42
# sanitize error
43
error = [l
for
l
in
error.strip().
split
(
"\n"
)
if
l
and
"manpath"
not
in
l]
44
45
output = output.strip()
46
print
(output)
47
48
if
error:
49
print
(error)
50
sys.exit(1)
print
void print(char *figname, TCanvas *c1)
Definition
TRTCalib_StrawStatusPlots.cxx:26
split
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition
hcg.cxx:179
PyJobTransforms.trfAMI
Utilities for configuration of transforms via AMI tags.
Generated on
for ATLAS Offline Software by
1.17.0