Skip to content

Instantly share code, notes, and snippets.

@sugar84
Created September 22, 2011 11:41
Show Gist options
  • Select an option

  • Save sugar84/1234591 to your computer and use it in GitHub Desktop.

Select an option

Save sugar84/1234591 to your computer and use it in GitHub Desktop.
mojox_run error?
my $count = scalar keys %$all;
my (@shas, $i);
for my $disk (keys %$all) {
my $part = $all->{$disk}->{partition};
my $pid = $run->spawn(
cmd => sub {
# my @shas =
# map {/^([0-9a-f]+)/}
# qx(find $dest/$part -type f | grep -Fv "lost+found" | sort | xargs shasum)
# ;
# print "_\__" . join("", @shas) . "__/_";
print "_\__hello world!__/_";
# sleep 1;
exit 0;
},
exec_timeout => 60 * 60 * 4,
exit_cb => sub {
my ($pid, $res) = @_;
utf8::upgrade($_) for grep { $_ } @$res{qw(error stderr stdout)};
my ($sha) = $res->{stdout} =~ m{_\__(.*)__/_};
if ($disk eq $master->{disk}) {
unshift @shas, [ $sha, $disk, {%$res, pid => $pid} ];
} else {
push @shas, [ $sha, $disk, {%$res, pid => $pid} ];
}
$run->ioloop->stop if ++$i == $count;
},
);
}
$run->ioloop->start;
$self->log->warn( "AAAAAA" . $self->dumper(\@shas) );
__END__
# and piece of logs
Thu Sep 22 14:31:57 2011 debug MojoX::Run:807 [4343]: 14400.000 seconds]
Thu Sep 22 14:31:57 2011 debug MojoX::Run:849 [4343]: Subprocess spawned as pid 4684.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:861 [4343]: [process 4684]: Setting execution timeout to 14400.000 seconds.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:899 [4343]: [process 4684]: handles: stdin=8b2ad88, stdout=8b2e910, stderr=8b2ecc0
Thu Sep 22 14:31:57 2011 debug MojoX::Run:927 [4343]: [process 4684]: stdio stream timeout set to 14401 seconds.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:807 [4343]: 14400.000 seconds]
Thu Sep 22 14:31:57 2011 debug MojoX::Run:849 [4343]: Subprocess spawned as pid 4685.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:861 [4343]: [process 4685]: Setting execution timeout to 14400.000 seconds.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:899 [4343]: [process 4685]: handles: stdin=8b2b3f8, stdout=8b2aed8, stderr=8b2b168
Thu Sep 22 14:31:57 2011 debug MojoX::Run:927 [4343]: [process 4685]: stdio stream timeout set to 14401 seconds.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:807 [4343]: 14400.000 seconds]
Thu Sep 22 14:31:57 2011 debug MojoX::Run:849 [4343]: Subprocess spawned as pid 4686.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:861 [4343]: [process 4686]: Setting execution timeout to 14400.000 seconds.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1262 [4343]: [process 4684]: Got SIGCHLD, exited with exit status: 0 by signal 0.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1281 [4343]: [process 4684]: Removing timeout handler 8b15f70.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1305 [4343]: SIGCHLD handler cleaned up after 1 process(es).
Thu Sep 22 14:31:57 2011 debug MojoX::Run:899 [4343]: [process 4686]: handles: stdin=8b34f08, stdout=8b349e8, stderr=8b34c78
Thu Sep 22 14:31:57 2011 debug MojoX::Run:927 [4343]: [process 4686]: stdio stream timeout set to 14401 seconds.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:807 [4343]: 14400.000 seconds]
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1262 [4343]: [process 4685]: Got SIGCHLD, exited with exit status: 0 by signal 9.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1281 [4343]: [process 4685]: Removing timeout handler 8b2ab48.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1305 [4343]: SIGCHLD handler cleaned up after 1 process(es).
Thu Sep 22 14:31:57 2011 debug MojoX::Run:849 [4343]: Subprocess spawned as pid 4687.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:861 [4343]: [process 4687]: Setting execution timeout to 14400.000 seconds.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:899 [4343]: [process 4687]: handles: stdin=8562f08, stdout=8af5418, stderr=8562c78
Thu Sep 22 14:31:57 2011 debug MojoX::Run:927 [4343]: [process 4687]: stdio stream timeout set to 14401 seconds.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:977 [4343]: [process 4685]: (handle: 8b2aed8) Appending 117 bytes to STDOUT buffer.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:977 [4343]: [process 4684]: (handle: 8b2e910) Appending 117 bytes to STDOUT buffer.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:977 [4343]: [process 4687]: (handle: 8af5418) Appending 71 bytes to STDOUT buffer.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:977 [4343]: [process 4686]: (handle: 8b349e8) Appending 117 bytes to STDOUT buffer.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:995 [4343]: [process 4686]: (handle: 8b34c78) Appending 280 bytes to STDERR buffer.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1115 [4343]: [process 4684]: Error on handle 8b2ad88: Unknown error, probably harmless.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1029 [4343]: [process 4684]: STDIN closed.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1115 [4343]: [process 4685]: Error on handle 8b2b3f8: Unknown error, probably harmless.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1029 [4343]: [process 4685]: STDIN closed.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1021 [4343]: [process 4685]: STDOUT closed.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1021 [4343]: [process 4684]: STDOUT closed.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1025 [4343]: [process 4684]: STDERR closed.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1063 [4343]: [process 4684]: All streams closed, process execution complete.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1093 [4343]: [process 4684]: invoking exit_cb callback.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1025 [4343]: [process 4685]: STDERR closed.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1063 [4343]: [process 4685]: All streams closed, process execution complete.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1093 [4343]: [process 4685]: invoking exit_cb callback.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:995 [4343]: [process 4687]: (handle: 8562c78) Appending 91 bytes to STDERR buffer.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:977 [4343]: [process 4687]: (handle: 8af5418) Appending 46 bytes to STDOUT buffer.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:995 [4343]: [process 4687]: (handle: 8562c78) Appending 287 bytes to STDERR buffer.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:995 [4343]: [process 4687]: (handle: 8562c78) Appending 189 bytes to STDERR buffer.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1262 [4343]: [process 4686]: Got SIGCHLD, exited with exit status: 0 by signal 9.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1281 [4343]: [process 4686]: Removing timeout handler 8b347f8.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1305 [4343]: SIGCHLD handler cleaned up after 1 process(es).
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1115 [4343]: [process 4686]: Error on handle 8b34f08: Unknown error, probably harmless.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1029 [4343]: [process 4686]: STDIN closed.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1021 [4343]: [process 4686]: STDOUT closed.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1025 [4343]: [process 4686]: STDERR closed.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1063 [4343]: [process 4686]: All streams closed, process execution complete.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1093 [4343]: [process 4686]: invoking exit_cb callback.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1262 [4343]: [process 4687]: Got SIGCHLD, exited with exit status: 0 by signal 0.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1281 [4343]: [process 4687]: Removing timeout handler 8b2ef70.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1305 [4343]: SIGCHLD handler cleaned up after 1 process(es).
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1115 [4343]: [process 4687]: Error on handle 8562f08: Unknown error, probably harmless.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1029 [4343]: [process 4687]: STDIN closed.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1021 [4343]: [process 4687]: STDOUT closed.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1025 [4343]: [process 4687]: STDERR closed.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1063 [4343]: [process 4687]: All streams closed, process execution complete.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1093 [4343]: [process 4687]: invoking exit_cb callback.
# and dumper:
Thu Sep 22 14:31:57 2011 warn App::Disk:354 [4343]: AAAAAA[
[
'hello world!',
'sdb',
{
'cmd' => 'CODE',
'stderr' => 'Thu Sep 22 14:31:57 2011 debug MojoX::Run:157 [4686]: Killing subprocess 4684 with SIGKILL
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1093 [4686]: [process 4684]: invoking exit_cb callback.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:157 [4686]: Killing subprocess 4685 with SIGKILL
',
'time_stopped' => '1316712717.08902',
'time_started' => '1316712717.07412',
'time_duration_total' => '0.0161421298980713',
'exit_status' => 0,
'exit_core' => 0,
'pid' => 4686,
'exit_signal' => 9,
'error' => undef,
'stdout' => 'ESC[39;49m^MESC[50dESC[KESC[50;1HESC[?12lESC[?25hESC[?1049l^MESC[?1lESC>___hello world!__/_ESC[39;49mESC[K
ESC[50;1HESC[?12lESC[?25hESC[?1049l^MESC[?1lESC>',
'time_duration_exec' => '0.0149011611938477'
}
],
[
'hello world!',
'sde',
{
'cmd' => 'CODE',
'stderr' => '',
'time_stopped' => '1316712717.0766',
'time_started' => '1316712717.06767',
'time_duration_total' => '0.0191891193389893',
'exit_status' => 0,
'exit_core' => 0,
'pid' => 4684,
'exit_signal' => 0,
'error' => undef,
'stdout' => 'ESC[39;49m^MESC[50dESC[KESC[50;1HESC[?12lESC[?25hESC[?1049l^MESC[?1lESC>___hello world!__/_ESC[39;49mESC[K
ESC[50;1HESC[?12lESC[?25hESC[?1049l^MESC[?1lESC>',
'time_duration_exec' => '0.00892806053161621'
}
],
[
'hello world!',
'sdc',
{
'cmd' => 'CODE',
'stderr' => '',
'time_stopped' => '1316712717.08308',
'time_started' => '1316712717.07102',
'time_duration_total' => '0.0162980556488037',
'exit_status' => 0,
'exit_core' => 0,
'pid' => 4685,
'exit_signal' => 9,
'error' => undef,
'stdout' => 'ESC[39;49m^MESC[50dESC[KESC[50;1HESC[?12lESC[?25hESC[?1049l^MESC[?1lESC>___hello world!__/_ESC[39;49mESC[K
ESC[50;1HESC[?12lESC[?25hESC[?1049l^MESC[?1lESC>',
'time_duration_exec' => '0.0120649337768555'
}
],
[
'hello world!',
'sdd',
{
'cmd' => 'CODE',
'stderr' => 'Thu Sep 22 14:31:57 2011 debug MojoX::Run:157 [4687]: Killing subprocess 4686 with SIGKILL
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1093 [4687]: [process 4686]: invoking exit_cb callback.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:157 [4687]: Killing subprocess 4684 with SIGKILL
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1093 [4687]: [process 4684]: invoking exit_cb callback.
Thu Sep 22 14:31:57 2011 debug MojoX::Run:157 [4687]: Killing subprocess 4685 with SIGKILL
Thu Sep 22 14:31:57 2011 debug MojoX::Run:1093 [4687]: [process 4685]: invoking exit_cb callback.
',
'time_stopped' => '1316712717.09131',
'time_started' => '1316712717.07732',
'time_duration_total' => '0.0147538185119629',
'exit_status' => 0,
'exit_core' => 0,
'pid' => 4687,
'exit_signal' => 0,
'error' => undef,
'stdout' => 'ESC[39;49m^MESC[50dESC[KESC[50;1HESC[?12lESC[?25hESC[?1049l^MESC[?1lESC>___hello world!__/_ESC[39;49mESC[K
ESC[50;1HESC[?12lESC[?25hESC[?1049l^MESC[?1lESC>',
'time_duration_exec' => '0.0139949321746826'
}
]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment