4from PyJobTransforms.trfExceptions
import TransformAMIException
8msg = logging.getLogger(__name__)
15 import pyAMI.exception
16except ImportError
as e:
17 raise TransformAMIException(AMIerrorCode,
'Import of pyAMI modules failed ({0})'.format(e))
20 amiclient = getAMIClient()
21 result = get_ami_tag(amiclient, tag,
True)
22except 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))
31 msg.error(
"Error may not be fatal - will try AMI replica catalog")
33build, version = result[0][
"SWReleaseCache"].
split(
"_")
37folder_path = os.path.dirname(os.path.realpath(__file__))
38command = f
"{folder_path}/get_generator_versions.sh {build} {version} {tag}"
40output, error = subprocess.Popen([
"/bin/bash",
"-c", command], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
41output, error = output.decode(
"utf-8"), error.decode(
"utf-8")
43error = [l
for l
in error.strip().
split(
"\n")
if l
and "manpath" not in l]
45output = output.strip()
void print(char *figname, TCanvas *c1)
std::vector< std::string > split(const std::string &s, const std::string &t=":")