Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.
SOLVED

Alteryx API - Run Length

matthewbechard
8 - Asteroid

Hello-

 

Is there a "run length" field in the api  or both a start_time and a end_time field that can be used to calculate "run length"? 

Using the API endpoint /admin/v1/workflows/jobs/ ,  I only can seem to see createDate field. I am missing a field that would show the end time.

 

I am basically looking for this field shown below.

 

run_length.png

 

Any help would be appreciated.

 

Thanks,

Matt 

9 REPLIES 9
joshuaburkhow
ACE Emeritus
ACE Emeritus

There's nothing in that API endpoint that I know of. What I do is build a workflow that pulls this data from my MongoDB instances that way I can get exactly what I want. I also recommend implementing the "Alteryx Server Usage Report" if you haven't seen it yet as it has a lot of great detail on your workflows. 

Joshua Burkhow - Alteryx Ace | Global Alteryx Architect @PwC | Blogger @ AlterTricks
MattH
Alteryx
Alteryx

Hi @matthewbechard,

 

@joshuaburkhow is correct.  Currently the API does not report the completion time of a workflow run.  Also, as mentioned above, this information can be pulled from your MongoDB instance, on the AlteryxService database and in the AS_Queue and AS_Results tables. To find workflows run through the API, you will need to filter on the IsHidden field (set it to filter on True) in the AS_Queue collection.  Please note, if you have the functionality to allow users to run workflows without signing in, these will also be reported.  If this is the case, you can also add a filter to match the username to the the SubscriptionID that houses the workflows.

 

Attached is a sample workflow I use to get Run and Queue times for workflows running through the Gallery that you can use.  Just swap out the server name and passwords in the MongoDB Input tools

matthewbechard
8 - Asteroid

Thank you for your input!

matthewbechard
8 - Asteroid

Matt -Thank you for your input....  I wanted to accept this answer as the solution, but I click accept by accident on another answer.  The mongo db flow gave me exactly what I was looking for.  

 

Thanks again,

Matt

bertal34
9 - Comet

@MattH 

 

Hi Matt - in the Mongo data, how can you tell difference between a job that was run manually vs one that was truly scheduled?

dheissner
Alteryx Alumni (Retired)

Hi @MattH, The workflow you provided has a dependency on C:\Users\kcunningham\Documents\UsageReporting2\blobInput.yxdb

 

So it doesn't run. Any help on this? 

MattH
Alteryx
Alteryx

You've probably already found this, but one of the columns coming out of AS_Queue is AS_Schedules__ID.  If a workflow is being run from a schedule, this column will be populated with the MongoDB _id of that schedule.  If it is blank, then it is a manual Gallery run.

MattH
Alteryx
Alteryx

Hi @dheissner, The C:\Users\kcunningham\Documents\UsageReporting2\blobInput.yxdb dependency can be ignored.  The file was used to create the macro input schema for ServiceDataPaerser macro, which should persist without that file.  

 

In our 2023.2 release of Alteryx Server, we removed the ServiceBlob from most of the MongoDB collections and directly output the contents to the collection.  If you are running Server 2023.2, this could be the reason for an error in the workflow.  You can simply delete the macro and connect around.

MattH
Alteryx
Alteryx

Attached is an updated version for 2023.2 which no longer uses the macro.  I've also set it to pull out all fields from the collections.