Get last run time for workflows
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Im trying to use the API to output some data on workflows for use in MI. I really want to know the last run date of all workflows as well as the run length. I am looking at /admin/v1/workflows/jobs but am not sure its giving me the output I need, in fact, Im not sure what its actually giving me! It outputs a field called 0 and that seems to be the only field with data, but also about 50% of the rows returned seem to have nothing in the 0 column and none of the rows has anything in the other columns as you can see by the screenshot - is there a way to get what I want, is it this endpoint?
- Labels:
- API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I would run "/v3/workflows" to get the list of all Workflow IDs, then run "/v3/workflows/{WorkflowID}/jobs" to get all the jobs related to the workflows, and now you should have data for each workflow's job with the "createDate" per job. which is when did the job got initiated, also in this query you will find a lot of useful information related to the job. If you want you can further "/v3/jobs/{JobID}" to find the messages and output, runCount, isChained etc. but I haven't seen "run length" data info, I think it is lacking that in API like many things else that Alteryx was short on when creating the API.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Depending on your version of Alteryx, as @AshRez mentioned, try the v3 API if possible (I think > 2021.4).
I also, have not seen Run Length. I would be looking for when the job was initialised, and when it finished, as I don't think Run Length will be there. Initialisation time should be a column on the job, whereas finishing time might need to be extracted from the job log if it's not available straight up.
Also, in your screenshot, the 0 column will indicate RecordNo = 0. If it comes in from the API in this format, it is trying to parse the json but failing because everything is wrapped in Record:0 tag and it didn't expect that. Drop the excess fields and then JSON parse column [0] will hopefully blow it out to a table. (may need some funny business, not sure).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
That seems to work - although I seem to have some workflows that have been ran in the past that are not returning any data, not sure if that means its not been ran in such a long time that its been purged, or maybe if its not been ran since we upgraded the server it wont show?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
if it is on the server webpage, you should be able to pull it, the only problem I would assume is permission, or no data on the server webpage. if it is neither issue, it could be an API issue and you can report it to Alteryx support.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Does a job get created every time you run a workflow? So if I give a user access to run the workflow on the server, when they run it, it will create a job? And is that also the same for scheduled workflows? Im trying to track down why I have nearly 200 workflows with no info coming out of the API when I call the Jobs endpoint and pass in the workflow id. I dont believe that many have never been ran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
every Workflow that run is called job for each run. You need to confirm if you can see it on the GUI webpage, if it is not there, then there is no data to pull. but if it is there then this must be a permission issue. try to run the API with a Curator account to see if that shows everything. Alteryx Server has a lot of restrictions on the non-Curator accounts when pulling API, even if you can see it on the webpage.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I am running it as my account and I am a Curator, we can see a lot of workflows that have no jobs associated with them but we know they have been run. Oh well, time to log another support call!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Discovered there is a purge setting in the sever setup and its set to 90 days, so I assume that blanks are wokrflows not ran in the past 90 days!
