Automic Workload Automation

  • 1.  Using API to get running job report - V11

    Posted Feb 09, 2017 06:08 PM
    Has anyone used the Java API to get the Report of a job that is still running?

    I can do this to get the finished report
    Report jobLog = new Report(runID, 'REP')
    connectionService.sendRequestAndWait(jobLog)
    But I've only been able to get as far as getting the location of the running report from the directory tab. I can't find a way to "Open" that file via the API

    GetOutputDirectory directory_tab = new GetOutputDirectory(runID)
    sendrequestandwait(directory_tab)
    Iterator<GetOutputDirectory.OutputDirectoryItem> it = direcotry_tab.iterator();




  • 2.  Using API to get running job report - V11

    Posted Feb 10, 2017 09:49 AM
    The running job report is stored on the specific host and isn't returned to the AE until completion, which means you would need to gather the host info and report file name (based on RunID) and connect separately to find it. I recently wrote an AE script that would perform this same function; I havent tried it in Java but much of it would be outside of the API classes.


  • 3.  Using API to get running job report - V11

    Posted Nov 01, 2017 08:46 PM
    Reviving this -- does anyone know if the API can get a report for a running job in v12?


  • 4.  Using API to get running job report - V11

    Posted Nov 02, 2017 07:20 AM
    Here is a bit of code that will fetch all of the reports that are currently available in the Automation Engine.
    private void getreportList(int runId) {
        ReportTypeList reportTypeList = new ReportTypeList(runId);
        localUC4Object.sendRequestAndWait(reportTypeList);
        Common.getMsgBox(reportTypeList);
        log.writeLine("================================================================================");
        for (String reportType : reportTypeList) {
            String caption = reportTypeList.getCaption(reportType);
            log.writeLine(String.format("Report type: %s (%s)", reportType, caption));
            log.writeLine("--------------------------------------------------------------------------------");
            Report report = new Report(runId, reportType);
            localUC4Object.sendRequestAndWait(report);
            Common.getMsgBox(report);
            for (int pagenum = 1; pagenum <= report.getNumberOfPages(); pagenum++ ) {
                String currentPage = report.getReport();
                System.out.print(currentPage);
                report.nextPage(pagenum);
            }
            log.writeLine("--------------------------------------------------------------------------------");
            log.writeLine("");
        }
        log.writeLine("================================================================================");
        log.writeLine("");
    }
    If one views a job report in the Java GUI, one can load a partial report via the Directory tab.
    zckm4jxd1ay7.pnghttps://us.v-cdn.net/5019921/uploads/editor/ix/zckm4jxd1ay7.png" width="698">
    If one clicks the Download button, this fetches a copy of the partial report, directly to the computer where you are running the Java GUI.

    The ReportTypeList API class provides a list of the available reports for a given run ID. So for the above job, it would provide the list {ACT, REP, REV2, REV1, REV0}.

    I could not identify the specific API that corresponds to the Download button. I have not played around yet with the GetOutputDirectory class, so I do not know if it is possible to use this class to fetch the REP report of a job that has not completed. (But for what it’s worth, I do not think the the Download function in the GUI goes through the AE; I believe it fetches the log from the agent directly.)

    It should be relatively straightforward to do something like this:
    1. Convert the task run ID to an alphanumeric job ID, so that you know the name of the log file.
    2. Fetch the log file via SCP, CIFS, or some other method.


  • 5.  Using API to get running job report - V11

    Posted Nov 02, 2017 09:55 AM
    I tried out the GetOutputDirectory class, and confirmed that it does not provide the capability to download a report. All it does is let you know the type of report, whether it can be found in the AE DB, and (if it’s not in the DB) the file path name.
    private void getRep(int runId) {
        GetOutputDirectory outputDirectoryList = new GetOutputDirectory(runId);
        localUC4Object.sendRequestAndWait(outputDirectoryList);
        Common.getMsgBox(outputDirectoryList);
        for (GetOutputDirectory.OutputDirectoryItem outputDirectoryItem : outputDirectoryList) {
            if (("REP".equals(outputDirectoryItem.getReportID())) && (outputDirectoryItem.isOnAgent())) {
                String filepath = outputDirectoryItem.getFile();
                log.writeLine(String.format("Report file path : %s ", filepath));
                // Fetch file here
            }
        }       

    You must still find some other way to fetch the file from the agent.



  • 6.  Using API to get running job report - V11

    Posted Nov 02, 2017 04:53 PM
    Thanks,

    Michael A. Lowry

    ! I will pass this along to the developer.