Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Server Discussions

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

How to use events / run command to execute another workflow on Alteryx Gallery

ccagle
9 - Comet

Hi Everyone, 

 

I'm wanting to run another workflow on the gallery after the current one I run by using the events / run command tool. I found some documentation on how to issue the command (using AlteryxService.exe) along with the required arguments, but the problem I'm having is referencing the path to the workflow I'd like to execute on the server. I've tried a bunch of different things and the response I keep getting back is that the workflow cannot be found.

 

Does anyone know how I can reference the path of the workflow I'm wanting to execute on the gallery?

13 REPLIES 13
jrgo
14 - Magnetar

Hi @ccagle 

 

Is the workflow you're attempting to execute stored on a local drive on your Alteryx server or in a network location?

 

If it's on a network location, and the file path referenced in your command includes a mapped letter drive (e.g. W:\folder\workflow.yxmd), your issue is the mapped letter. The server does not resolve mapped letters because those are a local configuration on your machine. A fully qualified UNC path (e.g. \\server\folder\workflow.yxmd) when the service requires to read an asset that's NOT on any of it's local disks.

 

To complicate things a bit more, Windows Command does not accept UNC paths. There's workarounds (i.e. PUSHD), but it would make use of the command argument a bit more complicated as multiple commands are now needed so you may need to create a batch (.bat) file and have the run command execute that.

 

There's another another command to run workflows, AlteryxEngineCmd.exe, which runs a workflow without adding the workflow to your schedule queue (keeps your MongoDB clean). The same conditions apply as above in regards to referencing network files.

 

Alternatively, if your workflow DOES reside on a local disk within the Alteryx server, hard to say why it's not working. If you're able to, I'd suggest remoting into your Alteryx Server and run your workflow from there to see if it works or not. If it does work, then there may be a permission issue. Review the Alteryx System Settings to see how the "Run As" settings are configured and if the directory your workflows grant the necessary permissions to the service account (if set) to access the files.

 

Hope some of this helps!

Jimmy
Teknion Data Solutions

ccagle
9 - Comet

Thanks for your response, 

 

So I think this will make my question a little more targeted - I'm really trying to use the AlteryxEngineCmd.exe on the server, but I CANNOT figure out where the location of the workflow is on the server (and I saved it to the gallery just like any other workflow - so it's just a workflow somewhere in the gallery). 

 

To get a little more detailed - if I could figure out how and where Alteryx is storing ALL the workflows we have on the gallery, then I think it would be easy for me to issue the AlteryxEngineCmd.exe and point to the workflow on the gallery. What I'm seeing (correct me if I'm wrong) is that these workflows are stored in some Mongo DB fashion and I can't figure out how to target a specific workflow. If I need to take the route of saving this on a separate drive or on the server itself as a workflow (and not in the gallery), I can do that, but of course that is not optimal at all. I really just want to run 1 workflow on the gallery, and then run another one (same gallery, saved the exact same way) as a chain (one after the other) using the run command. 

 

Any help would be appreciated. As a side note, I've tested this functionality on my desktop and it works fine, so I understand where to find the executable, how to issue the command and point it to correct workflow to run, it's just the gallery issue above that I'm having trouble with. 

jrgo
14 - Magnetar

@ccagle 

 

Yeah, published workflows on Gallery are stored in persistence (MongoDB) as an encrypted BLOB document so there’s no path to reference. There is an API endpoint that can be used to extract/download a workflow that’s been published to Gallery. Theoretically speaking, you could have your workflow download and store in the workspace in prep for the cmd.

 

Saving the workflow flow to an accessible location (on the local drive within the server, preferably) is going to be your best bet.

 

Have to ask... any reason why you’re not just setting it up as a chained app? Maybe with more context to your use case, we might be able to share some alternative approaches.

Jimmy
Teknion Data Solutions

ccagle
9 - Comet

Thanks, I'll look into going that route. 

 

The only reason I didn't do a chained app was there's apparently a 30 second default timeout on the server for chained app (so first app has only 30 seconds to run). I did see an article where it looks like we can adjust this setting in the config file, which I might do. The first app in this case here is going to take a lot longer than 30 seconds to run. 

 

Thanks for the tips though I definitely appreciate it!

ccagle
9 - Comet

Actually I do need to modify my next comment a bit - so the reason I wanted to try to do a run command on the server was because as mentioned the first app takes > 30 seconds (can take 20 + min in some cases), and the 2nd app I have is a rendering of the data that the first app runs in visual format. 

 

Just for context, the first app will draw signal contours for radio stations (which can take a while depending on how many signals selected), and the 2nd app will then render those drawings in a map output that displays in the browser. Since I'd need to store the 2nd app on a drive and reference it (i.e. not on the server), I'm assuming all the render tools I have in that app wouldn't work because it's really just calling the workflow from a separate location (not the server). 

 

Any thoughts on that? 

jrgo
14 - Magnetar

@ccagle 

 

Had a feeling it was because of the chained app timeout. Yeah, the fix is easy to do and something I've done in various environments. That change, however, does not persist when Alteryx Server is updated so it's something that you have to remember to reapply.

 

Another option to explore is to convert your secondary app into a macro. This would still give you the option to control the processes, assuming that's the reason for this in general.

 

It'll be easier to manage in the long run i think...

ccagle
9 - Comet

Thanks again - yeah I thought about a macro as well, but the problem is that with my workflow I'm already running a batch macro to draw signal contours on multiple signals (which requires a batch and is pretty complicated), and I've always had trouble putting another macro in there while maintaining the proper execution timing. In this case, I need to write all the data to a database and ensure the entire batch is done prior to the final output running. I know there's a block until done tool, but I'm not sure how this will perform in this case and if it will be reliable with the complexity of this workflow. 

 

One of my Alteryx suggestions is for them to allow the user to prioritize or put timing on tools, but that's likely a significant change to the software (i.e. sometimes due to server latency, or whatever, it takes 'x' amount of seconds to complete calculations, write / store it somewhere, and you want other portions of the workflow to execute at various times +/- the initial calculations, or something similar). 

 

Thanks again for the tips

julialundrigan
5 - Atom

I was wondering if you ever got this working on your server - I am running in to the issue of how to reference the AlteryxEngineCmd.exe from the server. I have the second workflow on a shared drive the server is able to access (I have verified this as I have read in data from the shared drive in other workflows). I am using the first workflow to iterate until a file is found to know all my data is loaded. I am then trying to trigger a second workflow that will process the data. It works great on my local machine, but I want to be able to schedule it to run hourly, hence why I am looking to move it to the server. 

Thanks!

ccagle
9 - Comet

So what I ended up doing in my case, which is actually similar it sounds like (iterative macro for the first workflow, followed by a 2nd) is just turn them both into apps and chain them, which was fairly easy. The reason I did this in my case though was that the 2nd workflow I had was really just to render the results of the 1st in the gallery (i.e. a map display) and I wasn't sure if using the run command feature with the workflow being on a shared drive vs. the server would work. With that being said, to get the chained apps to work, I had to alter the Alteryx config file on the server and bump the chained timeout to 60 minutes in my case so I didn't get timeout errors (defaults to 30 seconds apparently). If you go this route and need to change the default setting, the article on how to do this is here: 

 

https://community.alteryx.com/t5/Alteryx-Server-Discussions/workflow-exceeded-maximum-runtime-of-30-...

 

I know that doesn't directly answer your question...so what I would do personally to test this is go into the server if you have that access, pull up the command prompt, and see if you can get it working manually first (point to the bin where the executable is on the server, and then enter the command and reference the workflow you are wanting to run). I would assume that if you have success there then that same command in your workflow should work once you load it on the server. If you have render results, I'm not sure they will display in the gallery output though, but you might not have that. 

 

This is probably not a formal answer but just my 2 cents based on my experience.