Example #1
0
def main():
  """
  Built a json output of the ld --trace data.
  """
  User = os.environ.get("USER",  "unknown")
  Host = os.environ.get("HOSTNAME","unknown")
  # push User, host and command line on to XALT_Stack
  XALT_Stack.push("User: "******"Host: " + Host)
  sA = []
  sA.append("CommandLine:")
  for v in sys.argv:
    sA.append('"'+v+'"')

  s = " ".join(sA)
  XALT_Stack.push(s)

  try:
    uuid        = sys.argv[ 1]
    status      = sys.argv[ 2]
    wd          = sys.argv[ 3]
    syshost     = sys.argv[ 4]
    execname    = sys.argv[ 5]
    xaltobj     = sys.argv[ 6]
    build_epoch = sys.argv[ 7]
    linklineFn  = sys.argv[ 8]
    resultFn    = sys.argv[ 9]

    if (execname.find("conftest") != -1):
      return 1
  
    hash_line   = capture(['sha1sum', execname])  
    if (hash_line.find("No such file or directory") != -1):
      return 1
    hash_id     = hash_line.split()[0]

    # Step one clean up linkline data
    sA = cleanup(xaltobj, linklineFn)
  
    resultT                  = {}
    resultT['uuid']          = uuid
    resultT['link_program']  = extract_compiler()
    resultT['build_user']    = User
    resultT['exit_code']     = int(status)
    resultT['build_epoch']   = float(build_epoch)
    resultT['exec_path']     = os.path.abspath(execname)
    resultT['hash_id']       = hash_id
    resultT['wd']            = wd
    resultT['build_syshost'] = syshost
    resultT['linkA']         = sA
    
    xfer  = XALT_transmission_factory.build(XALT_TRANSMISSION_STYLE,
                                            syshost, "link", resultFn)
    xfer.save(resultT)

  except Exception as e:
    print("XALT_EXCEPTION(xalt_generate_linkdata.py): ",e)
    logger.exception("XALT_EXCEPTION:xalt_generate_linkdata"+XALT_Stack.contents())

  return 0
Example #2
0
def main():

  try:
    # parse command line options:
    args = CmdLineOptions().execute()

    userExec = UserExec(args.exec_prog)
    if (not userExec.execName()):
      return

    userT    = UserEnvT(args, userExec).userT()
  
    submitT              = {}
    submitT['userT']     = userT
    submitT['xaltLinkT'] = ExtractXALT(userExec.execName()).xaltRecordT()
    submitT['libA']      = userExec.libA()
    submitT['envT']      = EnvT().envT()
    submitT['hash_id']   = userExec.hash()
  
    xfer  = XALT_transmission_factory.build(XALT_TRANSMISSION_STYLE,
                                            args.syshost, "run", args.resultFn)
    xfer.save(submitT)
  except Exception as e:
    print("XALT_EXCEPTION(xalt_run_submission.py): ",e)
    logger.exception("XALT_EXCEPTION:xalt_run_submission.py")
Example #3
0
def main():
    """
  Write the environment, XALT info from executable and use the
  transmission factory to save it.
  """

    try:
        # parse command line options:
        args = CmdLineOptions().execute()
        runA = json.loads(args.exec_progT[0])
        if (args.endTime > 0):
            uuidA = json.loads(args.uuidA)
        else:
            dateStr = capture("date +%Y_%m_%d_%H_%M_%S")[0:-1]
            N = len(runA)
            uuidA = []
            for i in xrange(N):
                fnA = []
                uuid = capture(args.uuidgen)[0:-1]
                fnA.append(os.environ.get("HOME", "/"))
                fnA.append("/.xalt.d/run.")
                fnA.append(args.syshost)
                fnA.append(".")
                fnA.append(dateStr)
                fnA.append(".")
                fnA.append(uuid)
                fnA.append(".json")
                fn = "".join(fnA)
                uuidA.append({'uuid': uuid, 'fn': fn})

        for i, run in enumerate(runA):
            uuid = uuidA[i]['uuid']
            fn = uuidA[i]['fn']
            userExec = UserExec(run['exec_prog'])
            if (not userExec.execName()):
                return

            userT = UserEnvT(args, uuid, run['ntasks'], userExec).userT()

            submitT = {}
            submitT['userT'] = userT
            submitT['xaltLinkT'] = ExtractXALT(
                userExec.execName()).xaltRecordT()
            submitT['libA'] = userExec.libA()
            submitT['envT'] = EnvT().envT()
            submitT['hash_id'] = userExec.hash()

            xfer = XALT_transmission_factory.build(XALT_TRANSMISSION_STYLE,
                                                   args.syshost, "run", fn)
            xfer.save(submitT)
        if (args.endTime == 0):
            print(json.dumps(uuidA))
    except Exception as e:
        print("XALT_EXCEPTION(xalt_run_submission.py): ", e, file=sys.stderr)
        logger.exception("XALT_EXCEPTION:xalt_run_submission.py")
def main():
  """
  Write the environment, XALT info from executable and use the
  transmission factory to save it.
  """

  try:
    # parse command line options:
    args = CmdLineOptions().execute()
    runA = json.loads(args.exec_progT[0])
    if (args.endTime > 0):
      uuidA = json.loads(args.uuidA)
    else:
      dateStr = capture("date +%Y_%m_%d_%H_%M_%S")[0:-1]
      N       = len(runA)
      uuidA   = []
      for i in xrange(N):
        fnA     = []
        uuid = capture(args.uuidgen)[0:-1]
        fnA.append(os.environ.get("HOME","/"))
        fnA.append("/.xalt.d/run.")
        fnA.append(args.syshost)
        fnA.append(".")
        fnA.append(dateStr)
        fnA.append(".")
        fnA.append(uuid)
        fnA.append(".json")
        fn = "".join(fnA)
        uuidA.append({'uuid' : uuid, 'fn' : fn})

    for i, run in enumerate(runA):
      uuid = uuidA[i]['uuid']
      fn   = uuidA[i]['fn']
      userExec = UserExec(run['exec_prog'])
      if (not userExec.execName()):
        return

      userT    = UserEnvT(args, uuid, run['ntasks'], userExec).userT()
  
      submitT              = {}
      submitT['userT']     = userT
      submitT['xaltLinkT'] = ExtractXALT(userExec.execName()).xaltRecordT()
      submitT['libA']      = userExec.libA()
      submitT['envT']      = EnvT().envT()
      submitT['hash_id']   = userExec.hash()
  
      xfer  = XALT_transmission_factory.build(XALT_TRANSMISSION_STYLE,
                                              args.syshost, "run", fn)
      xfer.save(submitT)
    if (args.endTime == 0):
      print(json.dumps(uuidA))
  except Exception as e:
    print("XALT_EXCEPTION(xalt_run_submission.py): ",e, file=sys.stderr)
    logger.exception("XALT_EXCEPTION:xalt_run_submission.py")
Example #5
0
def main():
  """
  Write the environment, XALT info from executable and use the
  transmission factory to save it.
  """

  try:
    # parse command line options:
    args     = CmdLineOptions().execute()
    runA     = json.loads(args.execA[0])
    usr_cmdA = args.execA[1]
    dateStr  = time.strftime("%Y_%m_%d_%H_%M_%S",time.localtime(args.startTime))

    # build output file name (it is only use by the file transmission method)
    if (args.endTime > 0):
      key_prefix = "run_fini_"
      suffix     = "zzz"
    else:
      key_prefix = "run_strt_"
      suffix     = "aaa"

    for run in runA:
      fnA     = []
      fnA.append(os.environ.get("HOME","/"))
      fnA.append("/.xalt.d/run")
      fnA.append(".")
      fnA.append(args.syshost)
      fnA.append(".")
      fnA.append(dateStr)
      fnA.append(".")
      fnA.append(suffix)
      fnA.append(".")
      fnA.append(run['uuid'])
      fnA.append(".json")
      run['fn'] = "".join(fnA)

    tracing = os.environ.get("XALT_TRACING")
    if (tracing == "yes"):
      print ("XALT_TRANSMISSION_STYLE: ",XALT_TRANSMISSION_STYLE,"\n", file=sys.stderr)

    for i, run in enumerate(runA):
      uuid = run['uuid']
      fn   = run['fn']
      userExec = UserExec(run['exec_prog'])
      if (not userExec.execName()):
        if (tracing == "yes"):
          print ("Did not find executable, not writing .json file", file=sys.stderr)
          print ("User path is: ",os.environ.get("PATH"), file=sys.stderr)
        continue

      userT    = UserEnvT(args, uuid, run['ntasks'], userExec).userT()
  
      submitT              = {}
      submitT['cmdlineA']  = usr_cmdA
      submitT['userT']     = userT
      submitT['xaltLinkT'] = ExtractXALT(userExec.execName()).xaltRecordT()
      submitT['libA']      = userExec.libA()
      submitT['envT']      = EnvT().envT()
      submitT['hash_id']   = userExec.hash()
      key                  = key_prefix + uuid

      xfer  = XALT_transmission_factory.build(XALT_TRANSMISSION_STYLE,
                                              args.syshost, "run", fn)
      xfer.save(submitT, key)

  except Exception as e:
    print("XALT_EXCEPTION(xalt_run_submission.py): ",e, file=sys.stderr)
    logger.exception("XALT_EXCEPTION:xalt_run_submission.py")
Example #6
0
def main():
    """
  Write the environment, XALT info from executable and use the
  transmission factory to save it.
  """

    try:
        # parse command line options:
        args = CmdLineOptions().execute()
        runA = json.loads(args.execA[0])
        usr_cmdA = json.loads(args.execA[1])
        dateStr = time.strftime("%Y_%m_%d_%H_%M_%S",
                                time.localtime(args.startTime))

        # build output file name (it is only use by the file transmission method)
        if (args.endTime > 0):
            key_prefix = "run_fini_"
            suffix = "zzz"
        else:
            key_prefix = "run_strt_"
            suffix = "aaa"

        for run in runA:
            fnA = []
            fnA.append(os.environ.get("HOME", "/"))
            fnA.append("/.xalt.d/run")
            fnA.append(".")
            fnA.append(args.syshost)
            fnA.append(".")
            fnA.append(dateStr)
            fnA.append(".")
            fnA.append(suffix)
            fnA.append(".")
            fnA.append(run['uuid'])
            fnA.append(".json")
            run['fn'] = "".join(fnA)

        tracing = os.environ.get("XALT_TRACING")
        if (tracing == "yes"):
            print("XALT_TRANSMISSION_STYLE: ",
                  XALT_TRANSMISSION_STYLE,
                  "\n",
                  file=sys.stderr)

        for i, run in enumerate(runA):
            uuid = run['uuid']
            fn = run['fn']
            userExec = UserExec(run['exec_prog'])
            if (not userExec.execName()):
                if (tracing == "yes"):
                    print("Did not find executable, not writing .json file",
                          file=sys.stderr)
                    print("User path is: ",
                          os.environ.get("PATH"),
                          file=sys.stderr)
                continue

            userT = UserEnvT(args, uuid, run['ntasks'], userExec).userT()

            submitT = {}
            submitT['cmdlineA'] = usr_cmdA
            submitT['userT'] = userT
            submitT['xaltLinkT'] = ExtractXALT(
                userExec.execName()).xaltRecordT()
            submitT['libA'] = userExec.libA()
            submitT['envT'] = EnvT().envT()
            submitT['hash_id'] = userExec.hash()
            key = key_prefix + uuid

            xfer = XALT_transmission_factory.build(XALT_TRANSMISSION_STYLE,
                                                   args.syshost, "run", fn)
            xfer.save(submitT, key)

    except Exception as e:
        print("XALT_EXCEPTION(xalt_run_submission.py): ", e, file=sys.stderr)
        logger.exception("XALT_EXCEPTION:xalt_run_submission.py")
def main():
    """
  Built a json output of the ld --trace data.
  """
    User = os.environ.get("USER", "unknown")
    Host = os.environ.get("HOSTNAME", "unknown")
    # push User, host and command line on to XALT_Stack
    XALT_Stack.push("User: "******"Host: " + Host)
    sA = []
    sA.append("CommandLine:")
    for v in sys.argv:
        sA.append('"' + v + '"')

    s = " ".join(sA)
    XALT_Stack.push(s)

    try:
        i = 1
        uuid = sys.argv[i]
        i += 1
        status = sys.argv[i]
        i += 1
        wd = sys.argv[i]
        i += 1
        syshost = sys.argv[i]
        i += 1
        execname = sys.argv[i]
        i += 1
        hash_id = sys.argv[i]
        i += 1
        xaltobj = sys.argv[i]
        i += 1
        build_epoch = sys.argv[i]
        i += 1
        funcRawFn = sys.argv[i]
        i += 1
        linklineFn = sys.argv[i]
        i += 1
        resultFn = sys.argv[i]
        i += 1
        compT = json.loads(sys.argv[i])

        if (execname == "conftest"):
            return 1

        # Step one clean up linkline data
        sA = cleanup(xaltobj, linklineFn)

        # Step two extract functions from raw output from linker
        sB = readFunctionList(funcRawFn)

        resultT = {}
        resultT['uuid'] = uuid
        resultT['link_program'] = compT['compiler']
        resultT['link_path'] = compT['full_path']
        resultT['link_line'] = compT['link_line']
        resultT['build_user'] = User
        resultT['exit_code'] = int(status)
        resultT['build_epoch'] = float(build_epoch)
        resultT['exec_path'] = os.path.abspath(execname)
        resultT['hash_id'] = hash_id
        resultT['wd'] = wd
        resultT['build_syshost'] = syshost
        resultT['function'] = sB
        resultT['linkA'] = sA
        key = "link_" + uuid

        xfer = XALT_transmission_factory.build(XALT_TRANSMISSION_STYLE,
                                               syshost, "link", resultFn)
        xfer.save(resultT, key)

    except Exception as e:
        print("XALT_EXCEPTION(xalt_generate_linkdata.py): ", e)
        logger.exception("XALT_EXCEPTION:xalt_generate_linkdata" +
                         XALT_Stack.contents())

    return 0