arvados-cli 0.1.20171103184629 → 0.1.20171211220040

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/crunch-job +23 -6
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: accd434dcf518f07bedacd29fbbbb7fc9844501b
4
- data.tar.gz: 3820162ed9debcb488b2a26061a7d03d80183f8e
3
+ metadata.gz: 04d16a74e2d8bb5a6900bbefdce712737cc86254
4
+ data.tar.gz: cc875fe1b9ebcf42ba402c088f41856b641234ce
5
5
  SHA512:
6
- metadata.gz: 90a773825caaddaf6c9eb2f949f8d466280ce1ad2633276488078914821063b65f02e84a19635491e179785b490d79018fa190002556a1be5abd3d5334e71425
7
- data.tar.gz: 0bf9d5d0727c27c9c7019bc3b8f89af11460b179d256554e82793c7cfd758028317179fade31512148222ba102be6c42b1cabef169613da6b5bbe3b454aa9dcf
6
+ metadata.gz: 1d8bcd6524eee36cad5b927692712de72df4876a51c0918e95230a526ab7def1155a18d9fbda50c347efec6c14cdb179bbdcf14f3d0e5d4b3c325a3c3454d9ba
7
+ data.tar.gz: 39e36c49d04246ac2381c2c2353cbac34b7d13874367c02f04e7cb7e65ae7f37ecd1246ea13a731be14d694ec376db0268121af14679873226e5488ac59b04fa
data/bin/crunch-job CHANGED
@@ -1,10 +1,9 @@
1
1
  #!/usr/bin/env perl
2
+ # -*- mode: perl; perl-indent-level: 2; indent-tabs-mode: nil; -*-
2
3
  # Copyright (C) The Arvados Authors. All rights reserved.
3
4
  #
4
5
  # SPDX-License-Identifier: AGPL-3.0
5
6
 
6
- # -*- mode: perl; perl-indent-level: 2; indent-tabs-mode: nil; -*-
7
-
8
7
  =head1 NAME
9
8
 
10
9
  crunch-job: Execute job steps, save snapshots as requested, collate output.
@@ -1188,6 +1187,8 @@ sub reapchildren
1188
1187
  . $slot[$proc{$pid}->{slot}]->{cpu});
1189
1188
  my $jobstepidx = $proc{$pid}->{jobstepidx};
1190
1189
 
1190
+ readfrompipes_after_exit ($jobstepidx);
1191
+
1191
1192
  $children_reaped++;
1192
1193
  my $elapsed = time - $proc{$pid}->{time};
1193
1194
  my $Jobstep = $jobstep[$jobstepidx];
@@ -1259,7 +1260,6 @@ sub reapchildren
1259
1260
  $Jobstep->{finishtime} = time;
1260
1261
  $Jobstep->{'arvados_task'}->{finished_at} = strftime "%Y-%m-%dT%H:%M:%SZ", gmtime($Jobstep->{finishtime});
1261
1262
  retry_op(sub { $Jobstep->{'arvados_task'}->save; }, "job_tasks.update API");
1262
- process_stderr_final ($jobstepidx);
1263
1263
  Log ($jobstepidx, sprintf("task output (%d bytes): %s",
1264
1264
  length($Jobstep->{'arvados_task'}->{output}),
1265
1265
  $Jobstep->{'arvados_task'}->{output}));
@@ -1562,9 +1562,27 @@ sub preprocess_stderr
1562
1562
  }
1563
1563
 
1564
1564
 
1565
- sub process_stderr_final
1565
+ # Read whatever is still available on its stderr+stdout pipes after
1566
+ # the given child process has exited.
1567
+ sub readfrompipes_after_exit
1566
1568
  {
1567
1569
  my $jobstepidx = shift;
1570
+
1571
+ # The fact that the child has exited allows some convenient
1572
+ # simplifications: (1) all data must have already been written, so
1573
+ # there's no need to wait for more once sysread returns 0; (2) the
1574
+ # total amount of data available is bounded by the pipe buffer size,
1575
+ # so it's safe to read everything into one string.
1576
+ my $buf;
1577
+ while (0 < sysread ($reader{$jobstepidx}, $buf, 65536)) {
1578
+ $jobstep[$jobstepidx]->{stderr_at} = time;
1579
+ $jobstep[$jobstepidx]->{stderr} .= $buf;
1580
+ }
1581
+ if ($jobstep[$jobstepidx]->{stdout_r}) {
1582
+ while (0 < sysread ($jobstep[$jobstepidx]->{stdout_r}, $buf, 65536)) {
1583
+ $jobstep[$jobstepidx]->{stdout_captured} .= $buf;
1584
+ }
1585
+ }
1568
1586
  preprocess_stderr ($jobstepidx);
1569
1587
 
1570
1588
  map {
@@ -2036,8 +2054,7 @@ sub srun_sync
2036
2054
  }
2037
2055
  my $exited = $?;
2038
2056
 
2039
- 1 while readfrompipes();
2040
- process_stderr_final ($jobstepidx);
2057
+ readfrompipes_after_exit ($jobstepidx);
2041
2058
 
2042
2059
  Log (undef, "$label: exit ".exit_status_s($exited));
2043
2060
 
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.20171103184629
4
+ version: 0.1.20171211220040
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arvados Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-03 00:00:00.000000000 Z
11
+ date: 2017-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: arvados
@@ -164,7 +164,7 @@ dependencies:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0.8'
167
- description: Arvados command line tools, git commit 7c02cd4b2a226c0e341028379c30fdbad5815d99
167
+ description: Arvados command line tools, git commit 42377686908783fb9d043e616f099e153f7834bc
168
168
  email: gem-dev@curoverse.com
169
169
  executables:
170
170
  - arv