Get Jobs Filter for specific Errors

I have been working on utilizing the Get Jobs activity, currently I have it filtering looking for jobs that have the Stopped state in the last 30 mins then afterwards it will Start the job with the Start Job activity. There are specific errors that happen when an Citrix Environment is running slower than usual, causing an error to occur. What I would like to do is filter for those errors and then take start the job with this process I have been working on creating.

Thanks

I suggest looking over some of these posts: Search results for 'filter get jobs' - UiPath Community Forum
Also, check here for getting the logs through API: Possible to get the Job Log URL?

Iā€™m not sure how to get the Logs from Robots or Job runs.

Here is what an OrchestratorJob variable can access, but probably wonā€™t help get the logs.
image

Iā€™ve explored those options, Iā€™m trying to get to the Indexof(Info,ā€˜Action failed to execute as expectedā€™) Jobs. Iā€™ve tried putting that into the filter, but since itā€™s not an option I can not access. I just did a query with swagger and I keep getting an error.
{
ā€œmessageā€: ā€œAn organization unit is required for this action.ā€,
ā€œerrorCodeā€: 1101,
ā€œresourceIdsā€: null
}
I know what my Organization Unit is, but I donā€™t know how to incorporate that value into the odata query? Would you know by chance?
Iā€™m thinking that I may have to do a web api odata query to get the ā€œinfoā€ and do some web scraping to find specific errors. Be a pain, unless I can filter through the Get Jobs activity lol

I appreciate your help again ClaytonM!!

1 Like

Iā€™m not really familiar with API, enough to comment on this :thinking:

Check this solution: Error 1101 in HTTP request - #10 by Andrei_Oprea

No worries, Iā€™ve only seen one other post on here on this error, the original poster just need their Organizational Unit # and then they were good to go. I replied to that post to ask if they could put up a sample of how they ā€œplugged inā€ the OU #. But the post is from January, weā€™ll see I may hear back.

Another direction Iā€™ve thought of is do you how to get the running job to identify itself? My thought is if there is a way that the job that is running throughā€™s the specific error Iā€™m looking out for I could put a Start Job activity in the Tryā€¦Catch that the job is wrapped in. So if the specific error occurs it will start itself :slight_smile: But Iā€™m not sure how to make the job identify itself. I could plug in the name in an argument but we have like 85 jobs and have naming conventions for different environments, schedules etcā€¦ It would have too many possibilities of failure.

Yeah, so there are some ideas I can share that you might think about.

Best approach is a Framework concept where you have retry attempts when certain errors occur. You can look at the ReFramework that is a template found in Studio. A robust process should catch errors and clean up the environment, then re-attempt to process the item. So, with this approach, you technically donā€™t need a robot manager to rerun the jobs. However, at the same time, this doesnā€™t prevent items from failing if all retry attempts failed for the job run.

Alongside this concept, you can utilize Queues that have built-in retry attempts for items. However, like I mentioned, an item could fail all its retries still. Which in that case, you would need to build in a postpone method somehow to change the Failed items back to New, so they can be processed on the next job run.

Additionally, you can get the ProcessName from the project.json file located in the same directory as the job run. So if you use Read Text File, then Deserialize json to an object, where you can get the name of process (ie jsonObj(ā€œnameā€).ToString). Then, you have the ProcessName. But, you also need the Environment if you plan on using Start Job. For Environment, I suppose you can use Get Jobs and filter it down to the job that is running or last ranā€¦ alternatively, you can use a hardcoded value or Asset to store the Environment name to be used.

So those are some ideas also.

Regards.

1 Like

ClaytonM,

Appreciate your feedback! Iā€™m working taking one of our common jobs that weā€™ve cloned 40 times now and building it into a RE Framework. Iā€™m working on making it easy to adapt, so that cloning will be easy to do for the client. My contract is up in a couple of months so I want to have something easy for them to modify.
Iā€™m also still looking into figuring out how to use a web api odata query to get information about processes. I see possible benefits to still being able to use it at some point. I started looking into the HTTP Orchestrator activity. Seems like that might work for me to achieve what Iā€™m after also.

Thanks again for your help!!

1 Like