Batch file from Gallery, error code 1
- 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
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
Text Input:
cd\
cd C:\Windows\system32
aws s3 ls s3://us-east-2-xxxxxxxxxxxxxxxx --profile xxxxxx > \\local directory\
Run Command write
Run Command read
GetObject.bat configuration
 
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
Solved! Go to Solution.
- Labels:
- Amazon S3
- Batch Macro
- Developer
- Gallery
- Help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Unfortunately, no luck on the single line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Sorry for the late response, I've been out of the office. I will check with our admins and get back with you. -thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
[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:
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.
Thanks all for your help.
 
 
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@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
