Esempio n. 1
0
   print("Setting the parameters to connect to DataStage server")
   dsapi.DSSetServerParams(DS_DOMAIN_NAME, DS_USER_NAME, DS_PASSWORD, DS_SERVER)

   print("Loading the project {}".format(DS_PROJECT))
   hproj, err = dsapi.DSOpenProject(DS_PROJECT)
   if err:
      raise Exception("Can't open the project {}: {}".format(DS_PROJECT, err))

   print("Loading the job {}".format(DS_JOB_NAME))
   hjob, err = dsapi.DSOpenJob(hproj, DS_JOB_NAME)
   if err:
      raise Exception("Can't open the job {}: {}".format(DS_JOB_NAME, err))

   print("Getting an information about the job")

   res, err = dsapi.DSGetJobInfo(hjob, dsapi.DSJ_JOBSTATUS)
   if err:
      raise Exception("DSJ_JOBSTATUS. Can't get the job info: {}".format(err))
   print("DSJ_JOBSTATUS = {}".format(res))

   res, err = dsapi.DSGetJobInfo(hjob, dsapi.DSJ_PARAMLIST)
   if err:
      raise Exception("DSJ_PARAMLIST. Can't get the job info: {}".format(err))
   print("DSJ_PARAMLIST = {}".format(res))

   print("Blocking the job {}".format(DS_JOB_NAME))
   res, err = dsapi.DSLockJob(hjob)
   if err:
      raise Exception("Can't block the job: {}".format(err))

   print("Setting launch parameters")
Esempio n. 2
0
    dsapi.DSSetServerParams(DS_DOMAIN_NAME, DS_USER_NAME, DS_PASSWORD,
                            DS_SERVER)

    print("Loading the project {}".format(DS_PROJECT))
    hproj, err = dsapi.DSOpenProject(DS_PROJECT)
    if err:
        raise Exception("Can't open the project {}: {}".format(
            DS_PROJECT, err))

    print("Loading the job {}".format(DS_JOB_NAME))
    hjob, err = dsapi.DSOpenJob(hproj, DS_JOB_NAME)
    if err:
        raise Exception("Can't open the job {}: {}".format(DS_JOB_NAME, err))

    print("Getting the last start time of the job")
    job_start_timestamp, err = dsapi.DSGetJobInfo(hjob,
                                                  dsapi.DSJ_JOBSTARTTIMESTAMP)
    if err:
        raise Exception("Can't get job info {}: {}".format(DS_JOB_NAME, err))

    log_event, err = dsapi.DSFindFirstLogEntry(hjob, dsapi.DSJ_LOGANY,
                                               job_start_timestamp)
    if err:
        raise Exception("Can't get logs of job {}: {}".format(
            DS_JOB_NAME, err))

    print("Reading logs")
    event_id = log_event.eventId
    while True:
        log_detail, err = dsapi.DSGetLogEntry(hjob, event_id)
        if err:
            raise Exception("Can't get details for eventId = {}: {}".format(
   print("Setting the parameters to connect to DataStage server")
   dsapi.DSSetServerParams(DS_DOMAIN_NAME, DS_USER_NAME, DS_PASSWORD, DS_SERVER)

   print("Loading the project {}".format(DS_PROJECT))
   hproj, err = dsapi.DSOpenProject(DS_PROJECT)
   if err:
      raise Exception("Can't open the project {}: {}".format(DS_PROJECT, err))

   print("Loading the job {}".format(DS_JOB_NAME))
   hjob, err = dsapi.DSOpenJob(hproj, DS_JOB_NAME)
   if err:
      raise Exception("Can't open the job {}: {}".format(DS_JOB_NAME, err))

   print("Getting an information about the job\n")
   paramList, err = dsapi.DSGetJobInfo(hjob, dsapi.DSJ_PARAMLIST)
   if err:
      raise Exception("Can't get the job info: {}".format(err))
   print("DSJ_PARAMLIST = {}\n".format(paramList))

   for param in paramList:
      paramInfo, err = dsapi.DSGetParamInfo(hjob, dsapi.decodeBytes(param))

      print("paramName:    {}".format(param))
      if err:
         raise Exception("Can't get the parameter info: {}".format(err))

      print("helpText:     {}".format(paramInfo.helpText))
      print("paramPrompt:  {}".format(paramInfo.paramPrompt))
      print("paramType:    {}".format(paramInfo.paramType))
Esempio n. 4
0
                      (dsapi.DSJ_USERSTATUS, 'DSJ_USERSTATUS'),
                      (dsapi.DSJ_JOBCONTROL, 'DSJ_JOBCONTROL'),
                      (dsapi.DSJ_JOBPID, 'DSJ_JOBPID'),
                      (dsapi.DSJ_JOBINVOCATIONS, 'DSJ_JOBINVOCATIONS'),
                      (dsapi.DSJ_JOBINTERIMSTATUS, 'DSJ_JOBINTERIMSTATUS'),
                      (dsapi.DSJ_JOBINVOCATIONID, 'DSJ_JOBINVOCATIONID'),
                      (dsapi.DSJ_JOBDESC, 'DSJ_JOBDESC'),
                      (dsapi.DSJ_STAGELIST2, 'DSJ_STAGELIST2'),
                      (dsapi.DSJ_JOBELAPSED, 'DSJ_JOBELAPSED'),
                      (dsapi.DSJ_JOBDMISERVICE, 'DSJ_JOBDMISERVICE'),
                      (dsapi.DSJ_JOBMULTIINVOKABLE, 'DSJ_JOBMULTIINVOKABLE'),
                      (dsapi.DSJ_JOBFULLDESC, 'DSJ_JOBFULLDESC'),
                      (dsapi.DSJ_JOBRESTARTABLE, 'DSJ_JOBRESTARTABLE')]

    for infoType, infoName in infoTypes_list:
        res, err = dsapi.DSGetJobInfo(hjob, infoType)
        if err:
            print("{}. Can't get the job info: {}".format(infoName, err))
        else:
            print("{} = {}".format(infoName, res))

    print("Closing the job")
    dsapi.DSCloseJob(hjob)
    hjob = None

    print("Closing the project")
    dsapi.DSCloseProject(hproj)
    hproj = None

    dsapi.DSUnloadLibrary()