Sun Aug 19, 2018 3:53 pm
Login Register Lost Password? Contact Us


Best way to trigger system commands

Share ideas, code, best practices and techniques with other community members

Mon Apr 29, 2013 3:31 pm Change Time Zone

I want to trigger a system command on the master node at the end of a workunit. I remember seeing a function which will call a particular command on a node but I can not recollect where I saw it. Anyone remembers?
sbagaria
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 92
Joined: Thu Jul 05, 2012 9:23 pm

Mon Apr 29, 2013 6:03 pm Change Time Zone

The ECL action to trigger an event is NOTIFY. This will trigger the event that a scheduled workunit can be set to wait for. .

You can find more details in the ECL Scheduler guide:

http://hpccsystems.com/download/docs/ecl-scheduler


The example on page 12 of this guide shows a good example.

To run a system command, use the standard library function: CmdProcess

For example:

Code: Select all
STD.System.Util.CmdProcess('echo','George Jetson');


HTH,

Jim
JimD
 
Posts: 132
Joined: Wed May 18, 2011 1:35 pm

Mon Apr 29, 2013 6:13 pm Change Time Zone

Thanks. Unfortunately, the CmdProcess function is not working for me. The workunits do not terminate. The last line in the eclagent log says 'Obtained run lock'. Both for hthor and thor. Roxie also does not terminate but I don't have a log entry for roxie.

Pipe on the other hand works fine but it executes on the slave nodes whereas I want the command to be executed on the master node only.
sbagaria
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 92
Joined: Thu Jul 05, 2012 9:23 pm

Mon Apr 29, 2013 6:58 pm Change Time Zone

There is no active issue (bug) reported for CmdProcess currently, if you are unable to use it you probably need to open an issue in the Community Issue Tracker, and include a code sample if it is reproducable.

Are you getting this lock on the simple echo command that Jim posted, or are you trying to run something else?

Thanks,

Bob
bforeman
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 975
Joined: Wed Jun 29, 2011 7:13 pm

Mon Apr 29, 2013 9:51 pm Change Time Zone

It's the same command as Jim posted. I tried it on 4.0.0rc5 running on Ubuntu and 3.10.4-1 running on CentOS. I will log a Jira item.
sbagaria
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 92
Joined: Thu Jul 05, 2012 9:23 pm

Tue Apr 30, 2013 12:15 am Change Time Zone

Diagnosed the problem. Use the absolute path for the command. Also, the example you provided will not return anything as at least in Linux, echo repeats its arguments and not the standard input. cat was built to repeat standard input. So the correct example would be Std.System.Utils.CmdProcess('cat','George Jetson');

See issues
https://track.hpccsystems.com/browse/HPCC-9226
https://track.hpccsystems.com/browse/HPCC-9227
sbagaria
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 92
Joined: Thu Jul 05, 2012 9:23 pm

Tue Apr 30, 2013 11:51 am Change Time Zone

As noted in the above Jira items, this is now resolved for 3.10.8.
sbagaria
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 92
Joined: Thu Jul 05, 2012 9:23 pm

Tue Apr 30, 2013 11:53 am Change Time Zone

Thanks for the feedback, regarding the absolute path issue, ww will review the documentation and update as needed. Again, thanks very much!

Bob
bforeman
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 975
Joined: Wed Jun 29, 2011 7:13 pm

Tue Apr 30, 2013 11:56 am Change Time Zone

Noticed this was a cross-post: viewtopic.php?f=8&t=581

Also, the absolute path will only be needed for versions prior to 3.10.8. 3.10.8 and onwards will be able to search the standard path variable. If you are updating the doc, then please change the example to refer 'cat' instead of 'echo'.

Thanks :)
sbagaria
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 92
Joined: Thu Jul 05, 2012 9:23 pm


Return to Tips & Tricks

Who is online

Users browsing this forum: No registered users and 1 guest

cron