arvados-cli 0.1.20150522214217 → 0.1.20150526143156

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/crunch-job +43 -16
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99b8c07b3475f9b14be3792ee0563dbd9cbd861b
4
- data.tar.gz: 1a9c6e8c69eba7197c7f05318c66202f4fd532c1
3
+ metadata.gz: df49631b2b1c7ae33eb0d5d9e988e50a2fc0a311
4
+ data.tar.gz: fe0a40bf178a62a8518fec9c8ca699188d2a8d32
5
5
  SHA512:
6
- metadata.gz: 189053906f0dd364c0423fa8125272c1d769b6bda484686dc75cb0fe0726e11065b34faa1c8d2dff293260b9c346089b37082b99795f1e77c54c80eb79371510
7
- data.tar.gz: db61854c2308ac39798ed2a68bc3178b3b9b9ad3080a9f664e28de68a2699b983c1857802a14f60dffe3a21de1ffa4ca07f4fbade7b2e5522c62e5c183d1a5d8
6
+ metadata.gz: 59df31ffb182cdcc78b960b8ba439bed2f8b2d916d740ace0b92eb76a3de96169c193de30e3cedfb14e0df96cdda9a4eea32562735ff509f4e9a6b273028d1bb
7
+ data.tar.gz: b2afa69c6273326c575cc6e3c4a8c166c544288cb4d90eb6709ae813b69c953e4fad3aa6444797cba3f7318e3c6304f63afa8b198c635199c94a8422b28d5d65
data/bin/crunch-job CHANGED
@@ -598,19 +598,42 @@ else {
598
598
  "mkdir -p $ENV{CRUNCH_INSTALL} && cd $ENV{CRUNCH_TMP} && perl -");
599
599
 
600
600
  $ENV{"CRUNCH_GIT_ARCHIVE_HASH"} = md5_hex($git_archive);
601
+ my ($install_stderr_r, $install_stderr_w);
602
+ pipe $install_stderr_r, $install_stderr_w or croak("pipe() failed: $!");
603
+ set_nonblocking($install_stderr_r);
601
604
  my $installpid = fork();
602
605
  if ($installpid == 0)
603
606
  {
607
+ close($install_stderr_r);
608
+ fcntl($install_stderr_w, F_SETFL, 0) or croak($!); # no close-on-exec
609
+ open(STDOUT, ">&", $install_stderr_w);
610
+ open(STDERR, ">&", $install_stderr_w);
604
611
  srun (\@srunargs, \@execargs, {}, $build_script . $git_archive);
605
612
  exit (1);
606
613
  }
607
- while (1)
608
- {
609
- last if $installpid == waitpid (-1, WNOHANG);
614
+ close($install_stderr_w);
615
+ my $stderr_buf = '';
616
+ while ($installpid != waitpid(-1, WNOHANG)) {
610
617
  freeze_if_want_freeze ($installpid);
611
- select (undef, undef, undef, 0.1);
618
+ # Wait up to 0.1 seconds for something to appear on stderr, then
619
+ # do a non-blocking read.
620
+ my $bits = fhbits($install_stderr_r);
621
+ select ($bits, undef, $bits, 0.1);
622
+ if (0 < sysread ($install_stderr_r, $stderr_buf, 8192, length($stderr_buf)))
623
+ {
624
+ while ($stderr_buf =~ /^(.*?)\n/) {
625
+ my $line = $1;
626
+ substr $stderr_buf, 0, 1+length($line), "";
627
+ Log(undef, "stderr $line");
628
+ }
629
+ }
612
630
  }
613
631
  my $install_exited = $?;
632
+ close($install_stderr_r);
633
+ if (length($stderr_buf) > 0) {
634
+ Log(undef, "stderr $stderr_buf")
635
+ }
636
+
614
637
  Log (undef, "Install script exited ".exit_status_s($install_exited));
615
638
  foreach my $tar_filename (map { tar_filename_n($_); } (1..$git_tar_count)) {
616
639
  unlink($tar_filename);
@@ -700,9 +723,8 @@ for (my $todo_ptr = 0; $todo_ptr <= $#jobstep_todo; $todo_ptr ++)
700
723
  next;
701
724
  }
702
725
 
703
- pipe $reader{$id}, "writer" or croak ($!);
704
- my $flags = fcntl ($reader{$id}, F_GETFL, 0) or croak ($!);
705
- fcntl ($reader{$id}, F_SETFL, $flags | O_NONBLOCK) or croak ($!);
726
+ pipe $reader{$id}, "writer" or croak("pipe() failed: $!");
727
+ set_nonblocking($reader{$id});
706
728
 
707
729
  my $childslot = $freeslot[0];
708
730
  my $childnode = $slot[$childslot]->{node};
@@ -1862,6 +1884,12 @@ sub combined_git_archive {
1862
1884
  return $tar_contents;
1863
1885
  }
1864
1886
 
1887
+ sub set_nonblocking {
1888
+ my $fh = shift;
1889
+ my $flags = fcntl ($fh, F_GETFL, 0) or croak ($!);
1890
+ fcntl ($fh, F_SETFL, $flags | O_NONBLOCK) or croak ($!);
1891
+ }
1892
+
1865
1893
  __DATA__
1866
1894
  #!/usr/bin/perl
1867
1895
  #
@@ -1895,6 +1923,9 @@ my $install_dir = $ENV{"CRUNCH_INSTALL"} || (getcwd() . "/opt");
1895
1923
  my $job_work = $ENV{"JOB_WORK"};
1896
1924
  my $task_work = $ENV{"TASK_WORK"};
1897
1925
 
1926
+ open(STDOUT_ORIG, ">&", STDOUT);
1927
+ open(STDERR_ORIG, ">&", STDERR);
1928
+
1898
1929
  for my $dir ($destdir, $job_work, $task_work) {
1899
1930
  if ($dir) {
1900
1931
  make_path $dir;
@@ -1906,11 +1937,6 @@ if ($task_work) {
1906
1937
  remove_tree($task_work, {keep_root => 1});
1907
1938
  }
1908
1939
 
1909
- open(STDOUT_ORIG, ">&", STDOUT);
1910
- open(STDERR_ORIG, ">&", STDERR);
1911
- open(STDOUT, ">>", "$destdir.log");
1912
- open(STDERR, ">&", STDOUT);
1913
-
1914
1940
  ### Crunch script run mode
1915
1941
  if (@ARGV) {
1916
1942
  # We want to do routine logging during task 0 only. This gives the user
@@ -1971,10 +1997,6 @@ if (@ARGV) {
1971
1997
  }
1972
1998
  }
1973
1999
 
1974
- close(STDOUT);
1975
- close(STDERR);
1976
- open(STDOUT, ">&", STDOUT_ORIG);
1977
- open(STDERR, ">&", STDERR_ORIG);
1978
2000
  exec(@ARGV);
1979
2001
  die "Cannot exec `@ARGV`: $!";
1980
2002
  }
@@ -2034,6 +2056,11 @@ if ((-d $python_dir) and can_run("python2.7") and
2034
2056
  close($pysdk_cfg);
2035
2057
  }
2036
2058
 
2059
+ # Hide messages from the install script (unless it fails: shell_or_die
2060
+ # will show $destdir.log in that case).
2061
+ open(STDOUT, ">>", "$destdir.log");
2062
+ open(STDERR, ">&", STDOUT);
2063
+
2037
2064
  if (-e "$destdir/crunch_scripts/install") {
2038
2065
  shell_or_die (undef, "$destdir/crunch_scripts/install", $install_dir);
2039
2066
  } elsif (!-e "./install.sh" && -e "./tests/autotests.sh") {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arvados-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20150522214217
4
+ version: 0.1.20150526143156
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arvados Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-22 00:00:00.000000000 Z
11
+ date: 2015-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arvados
@@ -178,7 +178,7 @@ dependencies:
178
178
  - - "<"
179
179
  - !ruby/object:Gem::Version
180
180
  version: 1.0.0
181
- description: Arvados command line tools, git commit 0f125dd51c7dc13047672dee5362866f31885e0a
181
+ description: Arvados command line tools, git commit 9b67268ff45d2a552d21fa39f5086180f537ab4a
182
182
  email: gem-dev@curoverse.com
183
183
  executables:
184
184
  - arv