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

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Re-run workflow if error

jchulani13
5 - Atom

Hi All,

 

I'm struggling to find a way to achieve this.

I need to re-run a workflow if it errors out (error is caused by time out on 3rd party data source) until it runs successfully. Ideally this solution would work when running on Alteryx Gallery as well.

 

I tried using the below solution as I saw this on the forums but it does not seem to work. Anyone know of a way to achieve this? Thanks!

 

jchulani13_0-1614787481989.png

 

13 REPLIES 13
mceleavey
17 - Castor
17 - Castor

Hi @jchulani13 ,

 

there are different approaches to this if you are running it on a server compared to running it via the designer.

In your example, you are running it on the designer and so the method you've shown is correct. The only way to do that is to get Alteryx to trigger an event upon completion which will run in the event of an error. This will then trigger an external command via the command prompt to set the workflow to run again. This will loop continuously until the workflow runs without errors.

 

You say this doesn't seem to work...can you be more specific?

 

M.



Bulien

jchulani13
5 - Atom

Thank you for the response @mceleavey , this is the error I get even with the correct file path.

 

Designer x64 The Designer x64 reported: Error running Event #1: Failed to run external program "AlteryxEngineCmd.exe C:\Users\myusername\Desktop\Tableau Projects\R12 Log Automation\Rerun Test.yxmd": The system cannot find the file specified. (2)

 

How would this be done on the server? Am I right in thinking it would be an iterative macro of some sort?

mceleavey
17 - Castor
17 - Castor

Hi @jchulani13 ,

 

On the server you can actually build in logic to tell it to re-run on failure and attempt a certain amount of times before giving up. This is useful when you're dealing with intermittent network dropouts.

 

In your case, it looks like you're missing the quotes around the full path of the file.

Try the following:

 

AlteryxEngineCmd.exe "C:\Users\myusername\Desktop\Tableau Projects\R12 Log Automation\Rerun Test.yxmd"

 

That should fix it.

 

M.



Bulien

jchulani13
5 - Atom

For some reason, that still does not seem to work even when the workflow fails:

jchulani13_0-1614809217301.png

 

Could you point me in the right direction as to how I would go about doing this on the server? That would be ideal

 

SeanAdams
17 - Castor
17 - Castor

On the server - the simplest way is to do this with some kind of a semaphore or flag.

When your canvas runs successfully you create an empty file with a particular name as the last thing you do

Every time the canvas starts up - it checks for this filename - and if it exists then you don't pass any more records downstream.

And then you schedule your canvas to run every few mins.

 

You'd need to do this with batch macros I'd guess to stop the process running ahead.

 

Not sure if @mceleavey has another thought on this one?   

 
mceleavey
17 - Castor
17 - Castor

Hi @SeanAdams ,

 

No, I'm a bit stumped on this one.

Looping through a batch with the first check to pick up a file which is only there on successful completion would work, but I'm a bit confused by the last error posted by @jchulani13 . It looks like :

 

mceleavey_0-1615405980618.png

 

I'm running it with the same logic and it's clearly triggering the re-run but with no results.

I built a separate workflow which sends me an email, and although it triggers the event without error, I don't receive the email.

 

So...

 

 

mceleavey_2-1615406409397.png

 

 



Bulien

mceleavey
17 - Castor
17 - Castor

Hi @jchulani13  and @SeanAdams ,

 

I've been playing with this and I've got it working using a .bat file. Save the attached file somewhere changing the extension from .txt to .bat, and edit the file to change the filepath to point at your workflow and update the username and workflow name:

 

AlteryxEngineCmd.exe "C:\Users\{myusername}\Desktop\Tableau Projects\R12 Log Automation\{My Workflow}.yxmd"

 

In the event, browse to the .bat file.

 

mceleavey_0-1615411508736.png

 

This will now trigger the .bat file on failure.

I've tested this and it's working fine on my setup.

 

Hope this helps.

 

M.

 

 



Bulien

echuong1
Alteryx Alumni (Retired)

I do want to make it clear that the Alteryx Engine Command is available with one of our automations products (ex: Scheduler, Server). Using this approach would work on Server because of that. It will not work on Designer unless you also have Scheduler.

 

That being said, you could develop the workflow and run it on Server. If you wanted to test the workflow, you can have your admin log into the actual Server machine.

 

https://help.alteryx.com/current/designer/run-workflows-command-line 

raychase
11 - Bolide

You could also leverage the Alteryx Server API for this.  It would be pretty easy to use either a .ps1 or .bat script to send an API call to run the desired application as a post-run event upon failure.

 

This way, you're not reliant on storing the .yxmd outside of the MongoDB of the Alteryx Server.  No worries of versioning control.

Labels
Top Solution Authors