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 Designer Desktop Discussions

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

Batch file from Gallery, error code 1

BonusCup
10 - Fireball

Hi,

 

I need to download the most current file from a long list in an S3 bucket. Using the 2 below links I've created a workflow that creates a list of the files in the S3 bucket, sorts them with the most recent first and creates a batch file with the correct command for the AWS CLI.  I also have a 2nd workflow that runs the new batch file to download that file.  I use a ListRunner to run them both.

 

Download a Zipped Excel File from an Amazon S3 Bucket

Amazon S3 Download – Use Wildcards to Select a Single or Multiple Objects

 

0.workflow.JPG

 

 

 

 

Text Input:

cd\

cd C:\Windows\system32

aws s3 ls s3://us-east-2-xxxxxxxxxxxxxxxx --profile xxxxxx > \\local directory\

 

Run Command write

2.runCommand_writeBatch.JPG

 

Run Command read

3.runCommand_readList.JPG

 

GetObject.bat configuration

6.getObjectBatch.JPG

If I run the listrunner from my local PC both jobs run successfully and the most recent file downloads but after saving the listrunner to the Gallery and running it from there the listrunner log shows "error code: 1"

 

Alteryx Version: 2019.3.5.17947

Started running \\xxxxxxxxxx.enterprisenet.org\data3\xxxxxxxxx\Alteryx\mmsConfigWithDiary\automation\Workflows\1.getObject.yxmd

ToolId 1: 3 records were output

ToolId 2: \\ xxxxxxxxxx.enterprisenet.org\data3\xxxxxxxxx \Alteryx\mmsConfigWithDiary\automation\BatchFiles\ListFiles.bat|3 records were written to "\\ xxxxxxxxxx.enterprisenet.org\data3\xxxxxxxxx \Alteryx\mmsConfigWithDiary\automation\BatchFiles\Lis

Error - ToolId 2: The external program "\\ xxxxxxxxxx.enterprisenet.org\data3\xxxxxxxxx \Alteryx\mmsConfigWithDiary\automation\BatchFiles\ListFiles.bat" returned an error code: 1

Finished in 2.5 seconds with 1 error

 

Does anyone know how to correct this error?

 

Thank you

10 REPLIES 10
DavidP
17 - Castor
17 - Castor

I wonder if it would help to put all the text input commands in a single string. You can separate dos commands with an & like

 

cd\ & cd C:\Windows\system32 & aws s3 ls s3://us-east-2-xxxxxxxxxxxxxxxx --profile xxxxxx > \\local directory\

 

The error code one means there was an error when the commands executed which generally means there is a problem with them. I always try to get them to work in a Command Window and then replicate that exactly in Alteryx.

BonusCup
10 - Fireball

@DavidP 

 

Thanks, I will try putting it on one line like you suggested.  Weird thing is I can run it successfully in a Command Window.  I learned it as a good practice to do that too.

BonusCup
10 - Fireball

@DavidP 

Unfortunately, no luck on the single line.

danilang
19 - Altair
19 - Altair

Hi @BonusCup 

 

Error code 1 usually means that DOS can't find something, a file, part of a path, or an executable.  In your case, I suspect it's the latter.  aws.exe is not installed in c:\Windows\System32 by default.  According to one of the referenced posts, it the CLI for AWS.  Is this installed on the Alteryx Gallery server that you're using?

 

Dan

BonusCup
10 - Fireball

@danilang 

 

Sorry for the late response, I've been out of the office.  I will check with our admins and get back with you.  -thanks

BonusCup
10 - Fireball

@danilang 

 

I met with our Alteryx admins and they were able to install the AWS CLI on the server and created a profile for me.  When they run the below command from the server they are able to see the list of files in the bucket:

 

aws s3 ls s3://us-east-2-xxxxxxx-xxxx-xxxxxxxx/yyy/zzzzzzzzzzzzzz/ --profile xxxxxxxx

 

I changed the profile name in my workflow to match the profile from the server but am receiving error code 255 for both workflows

 

Job1:

Error - ToolId 2: The external program "\\xxxxxxxxxxxxxx\data3\yyyyyyyyyyyyyy\Alteryx\zzzzzzzzzzzzzzzz\automation\BatchFiles\ListFiles.bat" returned an error code: 255

 

Job2:

Error - ToolId 2: The external program "\\xxxxxxxxxxxxxx\data3\yyyyyyyyyyyyyy\Alteryx\zzzzzzzzzzzzzzzz\automation\BatchFiles\S3_getObject.bat" returned an error code: 255

 
 

 

 

BonusCup
10 - Fireball

[SOLVED]

 

Working with the admins we were able to solve the issue when running the workflow from the server.  After installing AWS CLI we were still getting an error.  They think it was a permissions issue, once they set it back to default permissions it ran successfully.  They also changed the location of the list.txt and batch files to be stored as Temps on the server.

 

Minor edits to the Field 1 input tool:

Previous:

cd\

cd C:\Windows\system32

aws s3 ls s3://us-east-2-xxxxxxxxxxxxxxxx --profile xxxxxx > \\local directory\

Working:

aws -profile xxxxxx s3 ls s3://us-east-2-xxxxxxxxxxxxxxxx > ./list.txt

 

New Run Command configuration:

cmdSolution.JPG

 

Instead of a listrunner we added the final Run Command to the workflow that runs the final batch file that downloads the file from the S3 bucket.

runDL.JPG

 

Thanks all for your help.

 

 

 

 

januV
5 - Atom

I am facing similar situation. The workflow has run command tool to write (AWS CLI command to download objects from s3) into test.bat file and execute it. Works perfectly in the designer, but when run from gallery facing this issue.

The external program "C:\XXXXXXXXXXXX\YYYYYYYYYY\Workflow\YYYYYYY\test.bat" returned an error code: 255".  
Note  :
Alteryx server side has AWS CLI V2 installed 
Created a named profile for the user in server side and tested (able to list/copy/move s3 objects) 
Verified that the workflow from the gallery is able access the .bat file in the above file path in the server machine and write into it.
I am not sure what is missing here. Any idea? Also you have mentioned that the admins have set back the permissions to default, can you please elaborate on that?
BonusCup
10 - Fireball

@januV I'm trying to remember everything with this workflow.  Unfortunately, I have moved on to a different employer so I'm unable to pull this up.  It does look like from your error message that it's trying to pull the .bat file from your C drive. The Gallery won't be able to pull from that location.  Did you try changing it to %ENGINE.tempfilepath%test.bat

 

BonusCup_0-1684521498770.jpeg

 

Labels