Technology and Beyond (TaB)
dexer - Printable Version

+- Technology and Beyond (TaB) (http://tab.d-thinker.org)
+-- Forum: The world of operating systems (/forumdisplay.php?fid=3)
+--- Forum: Distributed OS (/forumdisplay.php?fid=32)
+---- Forum: Management (/forumdisplay.php?fid=545)
+----- Forum: Demultiplexer (/forumdisplay.php?fid=516)
+----- Thread: dexer (/showthread.php?tid=5225)


dexer - xwcwt - 02-27-2016 11:09 AM

dexer is a distributed commands via ssh
guardian: xwcwt

Design:
After reading more source code of auth, I decide to write a simple plain bash script which is more appropriate.

the default hosts(ips) configuration file is $think_base/conf/ips.cfg, one ip(hostname) one line. the command is execed in a serial way.

Param: username command
Pseudo code:
Code:
$ips?=/thinker/etc/ips.cfg
if $ips not exist then $ips=$think_base/conf/ips.cfg
if 'p'  is a parameter then pastat=True; else pastat=False
if '--shell' is a parameter then use_shell=True; else use_shell=False

if use_shell then command = bash -c "$command"

globe_rr=0

if pastat == False
  for ip in $ips
  {
           ssh -t $username@$ip "$command" && rr=$? || rr=$?
           if $rr != 0 and globe_rr=0  then $globe_rr = $rr
   }
else
  array=(for ip in $ips; do put 'ssh "$usernmae@$ip" "$command" ' into the array;done)
  prun --no-error $array[@] && globe_rr =$? || globe_rr=$?
}

if report_error == True{
   return $globe_rr
}
else{
   return 0
}


Usage:
dexer username command"
username is the user to exec the command"
command is the command to be execed, need wrapped by ""

--report-error: True/False, if this is True, return value of dexer would be the first failed command. If this is False, return value of dexer would always be zero. Default: False

Examples:

Copy a file on a number of nodes in user gene:
Code:
dexer gene "cp /mnt/dstore/gene/glad/work/lingu/F159_L2_2-1mbp.fq /mnt/fastdata/bwamem" p

Reboot a number of nodes except for tb31-2:
Code:
dexer --ips=ips.lst "if [[ \`hostname\` != tb31-2 ]] ; then reboot; fi; "

A compound command:
Code:
dexer --ips=/thinker/etc/ips.cfg 'sh -c "echo lingu dir && pwd && ls ~lingu"'


Return non-zero when some command failed
Code:
dexer --report-error=True 'mountpoint /thinker/storage' p

Maintain:
the script is relative simple, if there's any error happens or need add more func, just do ops in the source code.

-----
20160406/gl: Added another example (compound command)
20160321/gl: Add another example.
20160321/xwcwt: add example.


RE: dexer - lingu - 02-27-2016 04:32 PM

Good to have it. Will try.


RE: dexer - lingu - 02-27-2016 05:05 PM

Need default IP list -- ips.cfg

----
[dev@tb33-1 bin]$ ./dexer "ls"
Usage:
./dexer username command
---username is the user to exec the command
---command is the command to be execed, need wrapped by ""
----

I think the code supports ips.cfg but somehow it does not work.

I will work on it.


RE: dexer - xwcwt - 02-27-2016 05:18 PM

(02-27-2016 05:05 PM)lingu Wrote:  Need default IP list -- ips.cfg

----
[dev@tb33-1 bin]$ ./dexer "ls"
Usage:
./dexer username command
---username is the user to exec the command
---command is the command to be execed, need wrapped by ""
----

I think the code supports ips.cfg but somehow it does not work.

I will work on it.

username is needed. you can use the script likes:
./dexer gene "ls"


RE: dexer - lingu - 02-28-2016 12:29 AM

The code is in cod://bin


RE: dexer - lingu - 03-08-2016 11:01 PM

An example:

Copy a file on a number of nodes in user gene:
Code:
dexer gene "cp /mnt/dstore/gene/glad/work/lingu/F159_L2_2-1mbp.fq /mnt/fastdata/bwamem" p



RE: dexer - lingu - 03-20-2016 04:49 PM

(03-08-2016 11:01 PM)lingu Wrote:  An example:

Copy a file on a number of nodes in user gene:
Code:
dexer gene "cp /mnt/dstore/gene/glad/work/lingu/F159_L2_2-1mbp.fq /mnt/fastdata/bwamem" p

Please add this example to the headpost.

dexer should also support the ips option -- "--ops=<ipsfile>".


RE: dexer - lingu - 03-21-2016 07:40 PM

Reboot a number of nodes except for the portal:

Code:
dexer --ips=ips.lst "if [[ \`hostname\` != tb31-2 ]] ; then reboot; fi; "



RE: dexer - lingu - 03-27-2016 03:23 PM

dexer only searches ~/think/conf/ips.cfg for the IP list, but it does not work before the thinker is installed. Also, some users, such as root, does not install a thinker.

I suggest we add a dir /thinker/etc and store a default ips.cfg file there, and let dexer search it at a lower priority.


RE: dexer - lingu - 03-27-2016 03:24 PM

(03-27-2016 03:23 PM)lingu Wrote:  dexer only searches ~/think/conf/ips.cfg for the IP list, but it does not work before the thinker is installed. Also, some users, such as root, does not install a thinker.

I suggest we add a dir /thinker/etc and store a default ips.cfg file there, and let dexer search it at a lower priority.

@zma pls review.


RE: dexer - zma - 03-27-2016 07:00 PM

(03-27-2016 03:24 PM)lingu Wrote:  
(03-27-2016 03:23 PM)lingu Wrote:  dexer only searches ~/think/conf/ips.cfg for the IP list, but it does not work before the thinker is installed. Also, some users, such as root, does not install a thinker.

I suggest we add a dir /thinker/etc and store a default ips.cfg file there, and let dexer search it at a lower priority.

@zma pls review.

That's okay for dexer to search for the ips.cfg file in a list of possible locations.

My question is who generates the ips.cfg file?


RE: dexer - lingu - 03-27-2016 08:33 PM

(03-27-2016 07:00 PM)zma Wrote:  
(03-27-2016 03:24 PM)lingu Wrote:  
(03-27-2016 03:23 PM)lingu Wrote:  dexer only searches ~/think/conf/ips.cfg for the IP list, but it does not work before the thinker is installed. Also, some users, such as root, does not install a thinker.

I suggest we add a dir /thinker/etc and store a default ips.cfg file there, and let dexer search it at a lower priority.

@zma pls review.

That's okay for dexer to search for the ips.cfg file in a list of possible locations.

My question is who generates the ips.cfg file?

Whoever likes to do it and has the privilege. Usually guardian or co-guardian and, for TB installation, the installation process should populate such a list.


RE: dexer - lingu - 04-03-2016 04:09 PM

dexer's behavior in the following example is confusing -- with the p argument it reports errors for 'mkdir -p'.

---
[gene6@tb6-1 S81]$ dexer "mkdir -p /mnt/fastdata/data"
10.28.1.2 "mkdir -p /mnt/fastdata/data":

10.28.2.2 "mkdir -p /mnt/fastdata/data":

10.28.3.2 "mkdir -p /mnt/fastdata/data":

10.28.4.2 "mkdir -p /mnt/fastdata/data":

10.28.5.2 "mkdir -p /mnt/fastdata/data":

10.28.6.2 "mkdir -p /mnt/fastdata/data":

10.28.7.2 "mkdir -p /mnt/fastdata/data":

10.28.8.2 "mkdir -p /mnt/fastdata/data":

[gene6@tb6-1 S81]$ dexer "mkdir -p /mnt/fastdata/data" p
10.28.1.2 "mkdir -p /mnt/fastdata/data":
10.28.2.2 "mkdir -p /mnt/fastdata/data":
10.28.3.2 "mkdir -p /mnt/fastdata/data":
10.28.4.2 "mkdir -p /mnt/fastdata/data":
10.28.6.2 "mkdir -p /mnt/fastdata/data":
10.28.5.2 "mkdir -p /mnt/fastdata/data":
10.28.7.2 "mkdir -p /mnt/fastdata/data":
10.28.8.2 "mkdir -p /mnt/fastdata/data":
bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory
bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory


bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory

bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory

bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory

bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory

bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory

bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory

[gene6@tb6-1 S81]$ dexer "mkdir -p /mnt/fastdata/data"
10.28.1.2 "mkdir -p /mnt/fastdata/data":

10.28.2.2 "mkdir -p /mnt/fastdata/data":

10.28.3.2 "mkdir -p /mnt/fastdata/data":

10.28.4.2 "mkdir -p /mnt/fastdata/data":

10.28.5.2 "mkdir -p /mnt/fastdata/data":

10.28.6.2 "mkdir -p /mnt/fastdata/data":

10.28.7.2 "mkdir -p /mnt/fastdata/data":

10.28.8.2 "mkdir -p /mnt/fastdata/data":
----


RE: dexer - lingu - 04-06-2016 12:56 PM

(04-03-2016 04:09 PM)lingu Wrote:  dexer's behavior in the following example is confusing -- with the p argument it reports errors for 'mkdir -p'.

---
[gene6@tb6-1 S81]$ dexer "mkdir -p /mnt/fastdata/data"
10.28.1.2 "mkdir -p /mnt/fastdata/data":

10.28.2.2 "mkdir -p /mnt/fastdata/data":

10.28.3.2 "mkdir -p /mnt/fastdata/data":

10.28.4.2 "mkdir -p /mnt/fastdata/data":

10.28.5.2 "mkdir -p /mnt/fastdata/data":

10.28.6.2 "mkdir -p /mnt/fastdata/data":

10.28.7.2 "mkdir -p /mnt/fastdata/data":

10.28.8.2 "mkdir -p /mnt/fastdata/data":

[gene6@tb6-1 S81]$ dexer "mkdir -p /mnt/fastdata/data" p
10.28.1.2 "mkdir -p /mnt/fastdata/data":
10.28.2.2 "mkdir -p /mnt/fastdata/data":
10.28.3.2 "mkdir -p /mnt/fastdata/data":
10.28.4.2 "mkdir -p /mnt/fastdata/data":
10.28.6.2 "mkdir -p /mnt/fastdata/data":
10.28.5.2 "mkdir -p /mnt/fastdata/data":
10.28.7.2 "mkdir -p /mnt/fastdata/data":
10.28.8.2 "mkdir -p /mnt/fastdata/data":
bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory
bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory


bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory

bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory

bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory

bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory

bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory

bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory

[gene6@tb6-1 S81]$ dexer "mkdir -p /mnt/fastdata/data"
10.28.1.2 "mkdir -p /mnt/fastdata/data":

10.28.2.2 "mkdir -p /mnt/fastdata/data":

10.28.3.2 "mkdir -p /mnt/fastdata/data":

10.28.4.2 "mkdir -p /mnt/fastdata/data":

10.28.5.2 "mkdir -p /mnt/fastdata/data":

10.28.6.2 "mkdir -p /mnt/fastdata/data":

10.28.7.2 "mkdir -p /mnt/fastdata/data":

10.28.8.2 "mkdir -p /mnt/fastdata/data":
----

Wentao - have you noticed this problem?

Pleaes also implement the support of /thinker/etc/ips.cfg


RE: dexer - xwcwt - 04-06-2016 02:49 PM

(04-06-2016 12:56 PM)lingu Wrote:  
(04-03-2016 04:09 PM)lingu Wrote:  dexer's behavior in the following example is confusing -- with the p argument it reports errors for 'mkdir -p'.

---
[gene6@tb6-1 S81]$ dexer "mkdir -p /mnt/fastdata/data"
10.28.1.2 "mkdir -p /mnt/fastdata/data":

10.28.2.2 "mkdir -p /mnt/fastdata/data":

10.28.3.2 "mkdir -p /mnt/fastdata/data":

10.28.4.2 "mkdir -p /mnt/fastdata/data":

10.28.5.2 "mkdir -p /mnt/fastdata/data":

10.28.6.2 "mkdir -p /mnt/fastdata/data":

10.28.7.2 "mkdir -p /mnt/fastdata/data":

10.28.8.2 "mkdir -p /mnt/fastdata/data":

[gene6@tb6-1 S81]$ dexer "mkdir -p /mnt/fastdata/data" p
10.28.1.2 "mkdir -p /mnt/fastdata/data":
10.28.2.2 "mkdir -p /mnt/fastdata/data":
10.28.3.2 "mkdir -p /mnt/fastdata/data":
10.28.4.2 "mkdir -p /mnt/fastdata/data":
10.28.6.2 "mkdir -p /mnt/fastdata/data":
10.28.5.2 "mkdir -p /mnt/fastdata/data":
10.28.7.2 "mkdir -p /mnt/fastdata/data":
10.28.8.2 "mkdir -p /mnt/fastdata/data":
bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory
bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory


bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory

bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory

bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory

bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory

bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory

bash: sh -c mkdir -p /mnt/fastdata/data: No such file or directory

[gene6@tb6-1 S81]$ dexer "mkdir -p /mnt/fastdata/data"
10.28.1.2 "mkdir -p /mnt/fastdata/data":

10.28.2.2 "mkdir -p /mnt/fastdata/data":

10.28.3.2 "mkdir -p /mnt/fastdata/data":

10.28.4.2 "mkdir -p /mnt/fastdata/data":

10.28.5.2 "mkdir -p /mnt/fastdata/data":

10.28.6.2 "mkdir -p /mnt/fastdata/data":

10.28.7.2 "mkdir -p /mnt/fastdata/data":

10.28.8.2 "mkdir -p /mnt/fastdata/data":
----

Wentao - have you noticed this problem?

Pleaes also implement the support of /thinker/etc/ips.cfg
I realized yesterday and busy in other things(I think it is not very emergency).

I take a look and find 'someone' add a strange syntax to execute the command in line 98:
Code:
shcmd="sh -c "$cmd
ssh $ssh_opt $usr@$ip "'$shcmd'"

I am wonder why need action likes this.

I think the previous is just
Code:
ssh $ssh_opt $usr@$ip "$cmd"

restore to above state and works.


RE: dexer - lingu - 04-06-2016 03:10 PM

(04-06-2016 02:49 PM)xwcwt Wrote:  I realized yesterday and busy in other things(I think it is not very emergency).

When you see it an don't think you can fix it in an hour, you should immediately write a reply and tell people you will work on it. Here is an example where I wrote such a reply -- http://tab.d-thinker.org/showthread.php?tid=5548&pid=17785#pid17785

If you plan to work on it but cannot get it done in 40 hours, please create a bugzilla task for it.

If you cannot get it done in 48hours and are not sure if you or somebody else will work on it, write a TODO or FR entry so that you or somebody else will handle it later.

Quote:I take a look and find 'someone' add a strange syntax to execute the command in line 98:

Perhaps I did. You can find who wrote it using 'gitk', which I find useful.

Quote:
Code:
shcmd="sh -c "$cmd
ssh $ssh_opt $usr@$ip "'$shcmd'"
I am wonder why need action likes this.

The change was perhaps due to the fact that we want to do some expansions such as '~'.

Quote:I think the previous is just
Code:
ssh $ssh_opt $usr@$ip "$cmd"

restore to above state and works.

OK. I will use it and perhaps follow up if I see any issues.


RE: dexer - lingu - 04-06-2016 04:33 PM

(04-06-2016 03:10 PM)lingu Wrote:  
(04-06-2016 02:49 PM)xwcwt Wrote:  restore to above state and works.

OK. I will use it and perhaps follow up if I see any issues.

It works well and tilde expansion works in the following example:

dexer --ips=/thinker/etc/ips.cfg 'sh -c "echo lingu dir && pwd && ls ~lingu"'


RE: dexer - YU_Xinjie - 01-22-2017 03:10 PM

We may consider to make the "return non-zero when the cmd on any node fails" to be the default behaviour of dexer.
It is usually helpful to exit as soon as possible when fails.
If dexer is run as root, it is even more important to stop when fails.

An implementation can be referred is the wait_errexit function in glad-common.sh.

@Zhiqiang @Wentao @lingu

What is your opinion?


RE: dexer - zma - 01-22-2017 04:12 PM

(01-22-2017 03:10 PM)YU_Xinjie Wrote:  We may consider to make the "return non-zero when the cmd on any node fails" to be the default behaviour of dexer.
It is usually helpful to exit as soon as possible when fails.
If dexer is run as root, it is even more important to stop when fails.

An implementation can be referred is the wait_errexit function in glad-common.sh.

@Zhiqiang @Wentao @lingu

What is your opinion?

Dying early and reporting early sounds a good idea to me as the default behavior.

If the users want to tolerate the failures in dexer, there are many way to be used.


RE: dexer - lingu - 01-22-2017 09:37 PM

(01-22-2017 04:12 PM)zma Wrote:  
(01-22-2017 03:10 PM)YU_Xinjie Wrote:  We may consider to make the "return non-zero when the cmd on any node fails" to be the default behaviour of dexer.
It is usually helpful to exit as soon as possible when fails.
If dexer is run as root, it is even more important to stop when fails.

An implementation can be referred is the wait_errexit function in glad-common.sh.

@Zhiqiang @Wentao @lingu

What is your opinion?

Dying early and reporting early sounds a good idea to me as the default behavior.

If the users want to tolerate the failures in dexer, there are many way to be used.

In distributed execution ("-p"), a scatter-gather is better than strict early termination which requires preemptive killing.

In any case, I think returning non-zero and early termination are two issues and in this case we handle returning non-zero only. It is fine that, if there is any failure from any scatter task on any node, dexer return non-zero.


RE: dexer - YU_Xinjie - 01-23-2017 08:41 PM

(01-22-2017 09:37 PM)lingu Wrote:  
(01-22-2017 04:12 PM)zma Wrote:  
(01-22-2017 03:10 PM)YU_Xinjie Wrote:  We may consider to make the "return non-zero when the cmd on any node fails" to be the default behaviour of dexer.
It is usually helpful to exit as soon as possible when fails.
If dexer is run as root, it is even more important to stop when fails.

An implementation can be referred is the wait_errexit function in glad-common.sh.

@Zhiqiang @Wentao @lingu

What is your opinion?

Dying early and reporting early sounds a good idea to me as the default behavior.

If the users want to tolerate the failures in dexer, there are many way to be used.

In distributed execution ("-p"), a scatter-gather is better than strict early termination which requires preemptive killing.

In any case, I think returning non-zero and early termination are two issues and in this case we handle returning non-zero only. It is fine that, if there is any failure from any scatter task on any node, dexer return non-zero.

Agreed. This is exactly what I want to say and how wait_errexit() of glad works.
Will propose a detailed design later.


RE: dexer - zma - 01-24-2017 10:52 AM

(01-23-2017 08:41 PM)YU_Xinjie Wrote:  
(01-22-2017 09:37 PM)lingu Wrote:  
(01-22-2017 04:12 PM)zma Wrote:  
(01-22-2017 03:10 PM)YU_Xinjie Wrote:  We may consider to make the "return non-zero when the cmd on any node fails" to be the default behaviour of dexer.
It is usually helpful to exit as soon as possible when fails.
If dexer is run as root, it is even more important to stop when fails.

An implementation can be referred is the wait_errexit function in glad-common.sh.

@Zhiqiang @Wentao @lingu

What is your opinion?

Dying early and reporting early sounds a good idea to me as the default behavior.

If the users want to tolerate the failures in dexer, there are many way to be used.

In distributed execution ("-p"), a scatter-gather is better than strict early termination which requires preemptive killing.

In any case, I think returning non-zero and early termination are two issues and in this case we handle returning non-zero only. It is fine that, if there is any failure from any scatter task on any node, dexer return non-zero.

Agreed. This is exactly what I want to say and how wait_errexit() of glad works.
Will propose a detailed design later.

To be clear, what I meant by "die early" is: if there are errors, stop invoking further more tasks, to make things simple. This is what wait_errexit() can be used for well.


RE: dexer - YU_Xinjie - 05-31-2017 11:40 AM

@Zhiqiang

Driving example:
When I am trying to update the bin tool on gm55 by dexer, I find it complains:
Code:
[root@gm55a-2 bin]# dexer 'cd /thinker/net/bin; make install'
10.6.1.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.2.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.3.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.4.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.5.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.6.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.7.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

I suggest we add a '-t' option into the ssh of dexer.
Please review.

Quote:...
ssh -t $username@$ip "$command"
...



RE: dexer - zma - 05-31-2017 11:57 AM

(05-31-2017 11:40 AM)YU_Xinjie Wrote:  @Zhiqiang

Driving example:
When I am trying to update the bin tool on gm55 by dexer, I find it complains:
Code:
[root@gm55a-2 bin]# dexer 'cd /thinker/net/bin; make install'
10.6.1.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.2.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.3.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.4.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.5.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.6.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.7.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

I suggest we add a '-t' option into the ssh of dexer.
Please review.

Quote:...
ssh -t $username@$ip "$command"
...

Sounds good.

BTW: it's strange bin's `make install` calls `sudo`. `make install` is supposed to do non-interactive installation while sudo may block it. Simple way is to require `make install` be run by root as in our common way.


RE: dexer - YU_Xinjie - 06-02-2017 01:43 PM

(05-31-2017 11:57 AM)zma Wrote:  
(05-31-2017 11:40 AM)YU_Xinjie Wrote:  @Zhiqiang

Driving example:
When I am trying to update the bin tool on gm55 by dexer, I find it complains:
Code:
[root@gm55a-2 bin]# dexer 'cd /thinker/net/bin; make install'
10.6.1.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.2.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.3.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.4.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.5.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.6.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.7.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

I suggest we add a '-t' option into the ssh of dexer.
Please review.

Quote:...
ssh -t $username@$ip "$command"
...

Sounds good.

@Zhiqiang
It is implemented but I find Sage/GLAD would report some warning/error message about tty when I am running test on gm55.
I will roll back the '-t' change first, and check it later.


RE: dexer - zma - 06-02-2017 03:10 PM

(06-02-2017 01:43 PM)YU_Xinjie Wrote:  
(05-31-2017 11:57 AM)zma Wrote:  
(05-31-2017 11:40 AM)YU_Xinjie Wrote:  @Zhiqiang

Driving example:
When I am trying to update the bin tool on gm55 by dexer, I find it complains:
Code:
[root@gm55a-2 bin]# dexer 'cd /thinker/net/bin; make install'
10.6.1.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.2.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.3.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.4.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.5.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.6.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

10.6.7.2: cd /thinker/net/bin; make install
Installing to /thinker/bin (run with sudo)
sudo: sorry, you must have a tty to run sudo
make: *** [install] Error 1

I suggest we add a '-t' option into the ssh of dexer.
Please review.

Quote:...
ssh -t $username@$ip "$command"
...

Sounds good.

@Zhiqiang
It is implemented but I find Sage/GLAD would report some warning/error message about tty when I am running test on gm55.
I will roll back the '-t' change first, and check it later.

OK. I suggest removing the `sudo` from bin's Makefile for this case. Please take a look.


RE: dexer - rayluk - 02-12-2018 08:04 PM

RR @zma

Currently dexer would return 0 when some of its command failed. I think this should be a bug

Quote:[rayluk@tb31-2 ~]$ dexer 'a'
10.6.1.2: a
bash: a: command not found

10.6.2.2: a
bash: a: command not found

10.6.3.2: a
bash: a: command not found

[rayluk@tb31-2 ~]$ echo $?
0


However, since many tools have used dexer, changing its behaviour of may cause a disaster.
Therefore, I think we can let always return 0 to be a feature of dexer. If we want non-zero result when the command failed, we add one more parameter.


RE: dexer - zma - 02-12-2018 08:15 PM

(02-12-2018 08:04 PM)rayluk Wrote:  RR @zma

Currently dexer would return 0 when some of its command failed. I think this should be a bug

Quote:[rayluk@tb31-2 ~]$ dexer 'a'
10.6.1.2: a
bash: a: command not found

10.6.2.2: a
bash: a: command not found

10.6.3.2: a
bash: a: command not found

[rayluk@tb31-2 ~]$ echo $?
0


However, since many tools have used dexer, changing its behaviour of may cause a disaster.
Therefore, I think we can let always return 0 to be a feature of dexer. If we want non-zero result when the command failed, we add one more parameter.

The return code is undefined. But forcing behavior changing may break too many tools.

I suggest doing so:

add --check-status option which

- if --check-status is specified: return 0 if all commands on all nodes return 0; return non 0 otherwise.
- the return code is undefined if --check-status is not specified


RE: dexer - YU_Xinjie - 02-12-2018 08:22 PM

(02-12-2018 08:04 PM)rayluk Wrote:  RR @zma

Currently dexer would return 0 when some of its command failed. I think this should be a bug

Quote:[rayluk@tb31-2 ~]$ dexer 'a'
10.6.1.2: a
bash: a: command not found

10.6.2.2: a
bash: a: command not found

10.6.3.2: a
bash: a: command not found

[rayluk@tb31-2 ~]$ echo $?
0


However, since many tools have used dexer, changing its behaviour of may cause a disaster.
Therefore, I think we can let always return 0 to be a feature of dexer. If we want non-zero result when the command failed, we add one more parameter.

I roughly remember I have proposed this issue but perhaps is still a TODO.

I have implemented a function named "wait_errexit" in cod://glad/glad/bin/glad-common.sh, which is a "return code respect" version of "wait".
You may consider to generalize/reuse that function in your design.


RE: dexer - rayluk - 02-13-2018 03:45 PM

@zma,

As from the previous discussion, I think we should let dexer return non-zero value when any of its child returned with a non-zero value.

I suggest we can follow the approach of mulop -- use an array of PID to keep track of the situation.

Since the pseudocode on headpost is not update, following is the current pseudocode as observed
Code:
$ips?=/thinker/etc/ips.cfg
if $ips not exist then $ips=$think_base/conf/ips.cfg
if 'p'  is a parameter then pastat=True; else pastat=False
if '--shell' is a parameter then use_shell=True; else use_shell=False

if use_shell then command = bash -c "$command"

if pastat == False
  for ip in $ips
  {
           ssh -t $username@$ip "$command"
   }
else
  for ip in $ips
  {
           ssh -t $username@$ip "$command" &
   }
}


pseudocode for non zero return value
Code:
$ips?=/thinker/etc/ips.cfg
if $ips not exist then $ips=$think_base/conf/ips.cfg
if 'p'  is a parameter then pastat=True; else pastat=False
if '--shell' is a parameter then use_shell=True; else use_shell=False

if use_shell then command = bash -c "$command"


(( -> globe_rr=0 ))
if pastat == False{
  for ip in $ips
   {
           ssh -t $username@$ip "$command" && rr=$? || rr =$?
           if $rr != 0 then $globe_rr = $rr
   }
else
  (( -> pid_array="" ))
  for ip in $ips
   {
           ssh -t $username@$ip "$command" & append $! to $pid_array
   }
   for $pid in $pid_array
   {
          wait $pid && rr=$? || rr =$?
          if $rr != 0 then $globe_rr = $rr
    }
}
return $globe_rr



RE: dexer - zma - 02-13-2018 03:59 PM

(02-13-2018 03:45 PM)rayluk Wrote:  @zma,

As from the previous discussion, I think we should let dexer return non-zero value when any of its child returned with a non-zero value.

--> http://tab.d-thinker.org/showthread.php?tid=5225&pid=64940#pid64940

Not its default behavior yet. We may start with making it an explicit option to enable this behavior.

The following design looks good to me.

Quote:I suggest we can follow the approach of mulop -- use an array of PID to keep track of the situation.

Since the pseudocode on headpost is not update, following is the current pseudocode as observed
Code:
$ips?=/thinker/etc/ips.cfg
if $ips not exist then $ips=$think_base/conf/ips.cfg
if 'p'  is a parameter then pastat=True; else pastat=False
if '--shell' is a parameter then use_shell=True; else use_shell=False

if use_shell then command = bash -c "$command"

if pastat == False
  for ip in $ips
  {
           ssh -t $username@$ip "$command"
   }
else
  for ip in $ips
  {
           ssh -t $username@$ip "$command" &
   }
}


pseudocode for non zero return value
Code:
$ips?=/thinker/etc/ips.cfg
if $ips not exist then $ips=$think_base/conf/ips.cfg
if 'p'  is a parameter then pastat=True; else pastat=False
if '--shell' is a parameter then use_shell=True; else use_shell=False

if use_shell then command = bash -c "$command"


(( -> globe_rr=0 ))
if pastat == False{
  for ip in $ips
   {
           ssh -t $username@$ip "$command" && rr=$? || rr =$?
           if $rr != 0 then $globe_rr = $rr
   }
else
  (( -> pid_array="" ))
  for ip in $ips
   {
           ssh -t $username@$ip "$command" & append $! to $pid_array
   }
   for $pid in $pid_array
   {
          wait $pid && rr=$? || rr =$?
          if $rr != 0 then $globe_rr = $rr
    }
}
return $globe_rr



RE: dexer - rayluk - 02-13-2018 04:12 PM

Ok, sorry for missing that post


(02-13-2018 03:59 PM)zma Wrote:  
(02-13-2018 03:45 PM)rayluk Wrote:  @zma,

As from the previous discussion, I think we should let dexer return non-zero value when any of its child returned with a non-zero value.

--> http://tab.d-thinker.org/showthread.php?tid=5225&pid=64940#pid64940

Not its default behavior yet. We may start with making it an explicit option to enable this behavior.

The following design looks good to me.



RE: dexer - YU_Xinjie - 02-13-2018 05:17 PM

(02-12-2018 08:22 PM)YU_Xinjie Wrote:  I roughly remember I have proposed this issue but perhaps is still a TODO.

I have implemented a function named "wait_errexit" in cod://glad/glad/bin/glad-common.sh, which is a "return code respect" version of "wait".
You may consider to generalize/reuse that function in your design.

@rayluk

Did you see my above reply ?

Counting mulop, we are going to have 3rd duplicated code about this part. Why do not you generalize it as a general tool as I suggest ?


RE: dexer - rayluk - 02-13-2018 05:48 PM

(02-13-2018 05:17 PM)YU_Xinjie Wrote:  
(02-12-2018 08:22 PM)YU_Xinjie Wrote:  I roughly remember I have proposed this issue but perhaps is still a TODO.

I have implemented a function named "wait_errexit" in cod://glad/glad/bin/glad-common.sh, which is a "return code respect" version of "wait".
You may consider to generalize/reuse that function in your design.

@rayluk

Did you see my above reply ?

Counting mulop, we are going to have 3rd duplicated code about this part. Why do not you generalize it as a general tool as I suggest ?

I thought you want me to use the logic from "wait_errexit" in dexer. As the logic of mulop fits more in dexer, I would choose a similar approach to implement. After that, all tool can use dexer as the general tool.


RE: dexer - YU_Xinjie - 02-13-2018 06:17 PM

(02-13-2018 05:48 PM)rayluk Wrote:  I thought you want me to use the logic from "wait_errexit" in dexer. As the logic of mulop fits more in dexer, I would choose a similar approach to implement. After that, all tool can use dexer as the general tool.

I feel those are different levels things.

wait_errexit is more basic. In #29 & #33, I hoped you can improve/generalize wait_errexit and use it in dexer.

dexer is a general tool for "ssh + wait_errexit", not for wait_errexit itself.
Next time, when you use `wait` in another script, you can not use dexer to replace `wait` but you can use `wait_errexit` to replace that.


RE: dexer - YU_Xinjie - 02-13-2018 06:44 PM

(02-13-2018 06:17 PM)YU_Xinjie Wrote:  
(02-13-2018 05:48 PM)rayluk Wrote:  I thought you want me to use the logic from "wait_errexit" in dexer. As the logic of mulop fits more in dexer, I would choose a similar approach to implement. After that, all tool can use dexer as the general tool.

I feel those are different levels things.

wait_errexit is more basic. In #29 & #33, I hoped you can improve/generalize wait_errexit and use it in dexer.

dexer is a general tool for "ssh + wait_errexit", not for wait_errexit itself.
Next time, when you use `wait` in another script, you can not use dexer to replace `wait` but you can use `wait_errexit` to replace that.

But I am fine if you still would rather not generalize wait_errexit.


RE: dexer - rayluk - 02-15-2018 12:04 PM

@Xinije, I remember I didn't use `jobs -p` in mulop as it is not reliable. When a job is done before you start `jobs -p`, it wouldn't get the pid of that job, which means it will not get the return code for that. Therefore, I will not follow the wait_errexit approach first.

Test code
Code:
[rayluk@desktop test]$ cat ./d.sh
#!/bin/bash

function pjob(){
  stime=$1
  rt=$2
  ( sleep $stime; exit $rt)&
}

echo sleep for 0 and return 1
pjob 0 1
for i in 1 2 3 4 5 6 7 8 9; do
  echo sleep for 4 and return 0
  pjob 4 0
done

echo waiting
jobpidlist=`jobs -p`
echo $jobpidlist
for pid in $jobpidlist;do
  wait $pid
  echo $?
done

After running the above code, we can observe that there are chances jobs -p misses some of the jobs when some jobs returned too fast. This is a popular case when the function failed in the first place.
Quote:[rayluk@desktop test]$ ./d.sh
sleep for 0 and return 1
sleep for 4 and return 0
sleep for 4 and return 0
sleep for 4 and return 0
sleep for 4 and return 0
sleep for 4 and return 0
sleep for 4 and return 0
sleep for 4 and return 0
sleep for 4 and return 0
sleep for 4 and return 0
waiting
30767 30768 30769 30771 30773 30775 30777 30778 30779 30780
1
0
0
0
0
0
0
0
0
0
[rayluk@desktop test]$ ./d.sh
sleep for 0 and return 1
sleep for 4 and return 0
sleep for 4 and return 0
sleep for 4 and return 0
sleep for 4 and return 0
sleep for 4 and return 0
sleep for 4 and return 0
sleep for 4 and return 0
sleep for 4 and return 0
sleep for 4 and return 0
waiting
30818 30819 30822 30823 30824 30826 30827 30828 30829
0
0
0
0
0
0
0
0
0



RE: dexer - rayluk - 05-30-2018 12:06 PM

RR zma

Since prun is now ready, it is not suitable me to continue on the proposal in this reply

I would also like to add a new parameter --allow-error

Following is the updated proposal for using prun.

Code:
(( -> globe_rr=0 ))

if pastat == False
  ssh -t $username@$ip "$command" (( -> && rr=$? || rr =$? ))
  (( -> if $rr != 0 and globe_rr=0  then $globe_rr = $rr ))
else
  (( for ip in $ips
  {
           ssh -t $username@$ip "$command" &
  }
  ->
  array=(for ip in $ips; do put 'ssh "$usernmae@$ip" "$command" ' into the array;done)
  prun --no-error $array[@] && globe_rr =$? || globe_rr=$?
  ))
}
if --allow-error
   return globe_rr
else
   return 0



RE: dexer - zma - 05-30-2018 12:21 PM

(05-30-2018 12:06 PM)rayluk Wrote:  RR zma

Since prun is now ready, it is not suitable me to continue on the proposal in this reply

I would also like to add a new parameter --allow-error

Following is the updated proposal for using prun.

Code:
(( -> globe_rr=0 ))

if pastat == False
  ssh -t $username@$ip "$command" (( -> && rr=$? || rr =$? ))
  (( -> if $rr != 0 and globe_rr=0  then $globe_rr = $rr ))
else
  (( for ip in $ips
  {
           ssh -t $username@$ip "$command" &
  }
  ->
  array=(for ip in $ips; do put 'ssh "$usernmae@$ip" "$command" ' into the array;done)
  prun --no-error $array[@] && globe_rr =$? || globe_rr=$?
  ))
}
if --allow-error
   return globe_rr
else
   return 0

OK except --allow-error. What's the semantics of it?


RE: dexer - rayluk - 05-30-2018 12:31 PM

(05-30-2018 12:21 PM)zma Wrote:  
(05-30-2018 12:06 PM)rayluk Wrote:  RR zma

Since prun is now ready, it is not suitable me to continue on the proposal in this reply

I would also like to add a new parameter --allow-error

Following is the updated proposal for using prun.

Code:
(( -> globe_rr=0 ))

if pastat == False
  ssh -t $username@$ip "$command" (( -> && rr=$? || rr =$? ))
  (( -> if $rr != 0 and globe_rr=0  then $globe_rr = $rr ))
else
  (( for ip in $ips
  {
           ssh -t $username@$ip "$command" &
  }
  ->
  array=(for ip in $ips; do put 'ssh "$usernmae@$ip" "$command" ' into the array;done)
  prun --no-error $array[@] && globe_rr =$? || globe_rr=$?
  ))
}
if --allow-error
   return globe_rr
else
   return 0

OK except --allow-error. What's the semantics of it?

--allow-error controlls the return value fo dexer
when --allow-error is not specified, it follows the old approach. It returns 0 no matter anything failed.
when --allow-error is specified, it would return the first non-zero return value of subprocesses. If all subprocesses returns zero, dexer will also returns zero.


RE: dexer - zma - 05-30-2018 12:33 PM

(05-30-2018 12:31 PM)rayluk Wrote:  
(05-30-2018 12:21 PM)zma Wrote:  
(05-30-2018 12:06 PM)rayluk Wrote:  RR zma

Since prun is now ready, it is not suitable me to continue on the proposal in this reply

I would also like to add a new parameter --allow-error

Following is the updated proposal for using prun.

Code:
(( -> globe_rr=0 ))

if pastat == False
  ssh -t $username@$ip "$command" (( -> && rr=$? || rr =$? ))
  (( -> if $rr != 0 and globe_rr=0  then $globe_rr = $rr ))
else
  (( for ip in $ips
  {
           ssh -t $username@$ip "$command" &
  }
  ->
  array=(for ip in $ips; do put 'ssh "$usernmae@$ip" "$command" ' into the array;done)
  prun --no-error $array[@] && globe_rr =$? || globe_rr=$?
  ))
}
if --allow-error
   return globe_rr
else
   return 0

OK except --allow-error. What's the semantics of it?

--allow-error controlls the return value fo dexer
when --allow-error is not specified, it follows the old approach. It returns 0 no matter anything failed.
when --allow-error is specified, it would return the first non-zero return value of subprocesses. If all subprocesses returns zero, dexer will also returns zero.

The old approach sounds "allow" errors.

Something like

--report-error=True|False (default False)

sounds more accurate.


RE: dexer - rayluk - 05-30-2018 06:48 PM

(05-30-2018 12:33 PM)zma Wrote:  
(05-30-2018 12:31 PM)rayluk Wrote:  
(05-30-2018 12:21 PM)zma Wrote:  
(05-30-2018 12:06 PM)rayluk Wrote:  RR zma

Since prun is now ready, it is not suitable me to continue on the proposal in this reply

I would also like to add a new parameter --allow-error

Following is the updated proposal for using prun.

Code:
(( -> globe_rr=0 ))

if pastat == False
  ssh -t $username@$ip "$command" (( -> && rr=$? || rr =$? ))
  (( -> if $rr != 0 and globe_rr=0  then $globe_rr = $rr ))
else
  (( for ip in $ips
  {
           ssh -t $username@$ip "$command" &
  }
  ->
  array=(for ip in $ips; do put 'ssh "$usernmae@$ip" "$command" ' into the array;done)
  prun --no-error $array[@] && globe_rr =$? || globe_rr=$?
  ))
}
if --allow-error
   return globe_rr
else
   return 0

OK except --allow-error. What's the semantics of it?

--allow-error controlls the return value fo dexer
when --allow-error is not specified, it follows the old approach. It returns 0 no matter anything failed.
when --allow-error is specified, it would return the first non-zero return value of subprocesses. If all subprocesses returns zero, dexer will also returns zero.

The old approach sounds "allow" errors.

Something like

--report-error=True|False (default False)

sounds more accurate.

--report-error is good to me

Implemented in commit a14d14cb24ede8b0c270444b26a150626a0a407c


RE: dexer - cchen - 06-07-2018 04:07 PM

I am not able to execute the command as described in the post. The error message is shown below:
Code:
[cchen@tb20-1 bin]$ dexer --ips=/thinker/etc/ips.cfg --report-error=True 'mountpoint /thinker/dstools' p
10.6.1.2 "mountpoint /thinker/dstools":
10.6.2.2 "mountpoint /thinker/dstools":
10.6.4.2 "mountpoint /thinker/dstools":
10.6.3.2 "mountpoint /thinker/dstools":
10.6.5.2 "mountpoint /thinker/dstools":
10.6.10.2 "mountpoint /thinker/dstools":
10.6.8.2 "mountpoint /thinker/dstools":
10.6.7.2 "mountpoint /thinker/dstools":
10.6.13.2 "mountpoint /thinker/dstools":
10.6.9.2 "mountpoint /thinker/dstools":
10.6.11.2 "mountpoint /thinker/dstools":
10.6.12.2 "mountpoint /thinker/dstools":
unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]
unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]
unknown option -- -

usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]

unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]


unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]
unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]


unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]

unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]
unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]


unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]
10.6.6.2 "mountpoint /thinker/dstools":
unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]


unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]

unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]

Please fix it
@ rayluk


RE: dexer - rayluk - 06-07-2018 04:29 PM

(06-07-2018 04:07 PM)cchen Wrote:  I am not able to execute the command as described in the post. The error message is shown below:
Code:
[cchen@tb20-1 bin]$ dexer --ips=/thinker/etc/ips.cfg --report-error=True 'mountpoint /thinker/dstools' p
10.6.1.2 "mountpoint /thinker/dstools":
10.6.2.2 "mountpoint /thinker/dstools":
10.6.4.2 "mountpoint /thinker/dstools":
10.6.3.2 "mountpoint /thinker/dstools":
10.6.5.2 "mountpoint /thinker/dstools":
10.6.10.2 "mountpoint /thinker/dstools":
10.6.8.2 "mountpoint /thinker/dstools":
10.6.7.2 "mountpoint /thinker/dstools":
10.6.13.2 "mountpoint /thinker/dstools":
10.6.9.2 "mountpoint /thinker/dstools":
10.6.11.2 "mountpoint /thinker/dstools":
10.6.12.2 "mountpoint /thinker/dstools":
unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]
unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]
unknown option -- -

usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]

unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]


unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]
unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]


unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]

unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]
unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]


unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]
10.6.6.2 "mountpoint /thinker/dstools":
unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]


unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]

unknown option -- -
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port]
           [-Q cipher | cipher-auth | mac | kex | key]
           [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
           [-w local_tun[:remote_tun]] [user@]hostname [command]

Please fix it
@ rayluk

This is because the dexer on tbg20 is not the latest one. Please have a try on limbo1 after updating bin on limbo1


RE: dexer - rayluk - 06-21-2018 07:15 PM

The --err-exit update had changed the behaviour of dexer with ;

As discussed with xinjie, it is first being reverted to an old version to let other software run first.


RE: dexer - YU_Xinjie - 06-21-2018 07:19 PM

(06-21-2018 07:15 PM)rayluk Wrote:  The --err-exit update had changed the behaviour of dexer with ;

As discussed with xinjie, it is first being reverted to an old version to let other software run first.

The ill case is http://tab.d-thinker.org/showthread.php?tid=11739&pid=76002#pid76002
Please investigate it later.


RE: dexer - lingu - 06-21-2018 07:26 PM

(02-12-2018 08:15 PM)zma Wrote:  
(02-12-2018 08:04 PM)rayluk Wrote:  RR @zma

Currently dexer would return 0 when some of its command failed. I think this should be a bug

Quote:[rayluk@tb31-2 ~]$ dexer 'a'
10.6.1.2: a
bash: a: command not found

10.6.2.2: a
bash: a: command not found

10.6.3.2: a
bash: a: command not found

[rayluk@tb31-2 ~]$ echo $?
0


However, since many tools have used dexer, changing its behaviour of may cause a disaster.
Therefore, I think we can let always return 0 to be a feature of dexer. If we want non-zero result when the command failed, we add one more parameter.

Returning non-zero is reasonable behavior. If it breaks programs, I hope limbo1 can catch the errors.

Quote:The return code is undefined. But forcing behavior changing may break too many tools.

I suggest doing so:

add --check-status option which

- if --check-status is specified: return 0 if all commands on all nodes return 0; return non 0 otherwise.
- the return code is undefined if --check-status is not specified

This is too much complexity. We need to weigh when to tolerate some imperfection and when to take what kind of risks. Here I think we should just simply implement the exit code and take the risk of breaking some programs. If those programs cannot handle failing exit code, those programs may be fixed anyway.