How do I troubleshoot command executor?

Questions and answers on how to get the most out of FFAStrans
Post Reply
crispyjones
Posts: 106
Joined: Wed Dec 27, 2017 3:21 am

How do I troubleshoot command executor?

Post by crispyjones »

I have a few workflows that upload to GoogleDrive, I accomplish this using Google's backup and sync app. It works ok, but is a bit slow and there is no way for FFAStrans to "know" when a file has completed uploading to Drive. I found this on github and set it up. It's pretty slick, let's you upload/download/delete files on Google Drive using command line. For instance this command

Code: Select all

"C:\Users\myusername\Desktop\ggsrun\ggsrun.exe upload" --nc -tz denver -p 1TT1dim_fJ_x9Vasdfasdfa --chunk 8 -f test.mp4 -j
will upload the file zoom.mp4 to the drive I've authorized, to the folder with id 1TT1dim_fJ_x9Vasdfasdfa as a multipart upload. I attempted to make this work in FFAStrans so I attached a watch folder to a command executor node containing the following

Code: Select all

%comspec% /c ""C:\Users\myusername\Desktop\ggsrun\ggsrun.exe" upload --nc -tz denver -p 1TT1dim_fJ_x9Vasdfasdfa --chunk 8 -f "%s_source%" -j"
and I get the following error
Command executor@KCNCEN250-04: Process exited with error code: 1 (Error: No materials for retrieving accesstoken. Please download 'client_secret.json'._)
That's odd because it's acting as if I haven't authorized ggsrun yet to access my google drive, but I have because the command works fine from the command line outside FFAStrans. This works

Code: Select all

"C:\Users\myusername\Desktop\ggsrun\ggsrun.exe" upload --nc -tz denver -p 1TT1dim_fJ_x9Vasdfasdfa --chunk 8 -f test.mp4 -j
and this works, which I thought was the exact thing the command executor was doing

Code: Select all

C:\Windows\system32\cmd.exe /C ""C:\Users\myusername\Desktop\ggsrun\ggsrun.exe" upload --nc -tz denver -p 1TT1dim_fJ_x9Vasdfasdfa --chunk 8 -f test.mp4 -j"
Now I don't expect anybody to troubleshoot this obscure app I am trying to use. I would like some help understanding why I can't get it to fail executing the same command outside FFAStrans. Perhaps another way to phrase my question is how do I replicate the FFAStrans command executor function outside of FFAStrans to help with troubleshooting?
crispyjones
Posts: 106
Joined: Wed Dec 27, 2017 3:21 am

Re: How do I troubleshoot command executor?

Post by crispyjones »

As usual 20 minutes after posting I figure it out, sort of :oops: . Found that I can set and environment variable called GGSRUN_CFG_PATH with the path to the config and client_secret files and now it works! I must admit I am still confused as to why this tweak was necessary, as it ran fine outside FFAStrans without that variable being set.
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: How do I troubleshoot command executor?

Post by emcodem »

Mr. Crispy, always good to hear from you.
Excuse the late reply please.
So those environment vars stuff is typical when trying to run programs as a service VS as a local application. The env vars are just different for a service, even if it runs under the same credentials as you are logged on with. Parts of the are solved using the CMD /C "" command instead of just executing the command without cmd /C, this might be one main reason for steinar to introduce this as default syntax for commandline proc.

However, how to debug this is that you just execute the "set" command and capture the output to a variable, write it to a text file. Compare the output of the ffastrans workflow which was executed as service to your local users output when just opening cmd and typing "set".
To be honest, in all my years as IT engineer, i never got into investigating which variables are set when exactly, i always just worked around so it works for the current usecase.
emcodem, wrapping since 2009 you got the rhyme?
crispyjones
Posts: 106
Joined: Wed Dec 27, 2017 3:21 am

Re: How do I troubleshoot command executor?

Post by crispyjones »

Thanks for the info on the "set" command, that's very helpful.
Post Reply