res, err = dsapi.DSRunJob(hjob, dsapi.DSJ_RUNNORMAL) if err: raise Exception("Can't launch the job: {}".format(err)) print("Deblocking the job") dsapi.DSUnlockJob(hjob) print("Waiting the end of the work proccess...") dsapi.DSWaitForJob(hjob) print("Forming the report") res, err = dsapi.DSMakeJobReport(hjob, dsapi.DSJ_REPORT0) if err: raise Exception("Can't form the report: {}".format(err)) res = dsapi.decodeBytes(res).split("\r\n") for info in res: print(info) print("Closing the job") dsapi.DSCloseJob(hjob) hjob = None print("Closing the project") dsapi.DSCloseProject(hproj) hproj = None dsapi.DSUnloadLibrary() except Exception as e: print("Runtime error: {}".format(str(e)))
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)) if paramInfo.paramType == dsapi.DSJ_PARAMTYPE_STRING: print("defaultValue: {}\n".format(paramInfo.defaultValue.paramValue.pString)) elif paramInfo.paramType == dsapi.DSJ_PARAMTYPE_ENCRYPTED: print("defaultValue: {}\n".format(paramInfo.defaultValue.paramValue.pEncrypt)) elif paramInfo.paramType == dsapi.DSJ_PARAMTYPE_INTEGER: print("defaultValue: {}\n".format(paramInfo.defaultValue.paramValue.pInt))