The issue seems to be with JobRun getLogItemsByJobRunId $JobKey $RunId command. I am able to reproduce, and here is what happening. As the time goes by, you may modify and save your job numerous times. When you change the Job the Job Key of it changes. The findAllRunKeysByJobKey command works fine, and it give you all job run keys, however getLogItemsByJobRunId does not correctly work if the passed JobKey does not match one of the historic runs, which were made prior to the Job change.
Basically, add few targets to your job, run it, then run your script, and you will see that job run logging. If you add another target, then you have modified the job (causing the job key to change). Now when you run your script, it picks up the new job key, and the old job run logs can no longer be retrieved using this new job key - only the run logs after the last job change can be retrieved. As soon as you modify the job again, all previous job runs can no longer be retrieved.
I filed defect QM001768475 for this.
As a workaround or alternative solution review the Utility name space for blcli commands to export logs for various job runs.
robert, can you explain the purpose of the script - you are trying to dump the log items from the script for what purpose ?
and how do you know you want the latest run of the job ? what is executing your jython ?
I have a jobs (a lof of) which I execute many times ( > 100 runs). And I just try to get one raport (csv) with
execution date; status; logs items. Why? mayby I found some kind of erros/wornings.
Despite the job exit with exit code 0, something might have gone wrong.
GUI clicking is time consuming task.
Robert, have you looked into Utility namespace?
getLogItemsByJobRunId has a bug and unless you would be able to supply the correct historic that matches the runId, you will only get the results after the last job modification (aka: last jobKey)
1 of 1 people found this helpful
if you want the job run logs you need to know the job run id for the run you want to get logs for. how do you plan to get that? or are you looking to get all job runs ? that does not seem very efficient so you should consider using some sort of filter to only pull the last X runs. you could still use most of your script logic above, but as lazar suggests, i'd consider using something from the Utility namespace. you may still run into a problem if you are trying to export the log for a job run that is in progress when you are running the export.