arvados-cli 0.1.20170807174734 → 0.1.20170817171636

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 +19 -19
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c3e6ebae502f711def28b531161777a6fbc69149
4
- data.tar.gz: 69297f05f05ed13ea3f3e09baf7326e1da141cff
3
+ metadata.gz: 87694867eb121f49f8d0e22049c263ec29a104fe
4
+ data.tar.gz: 92878792b8b22c8e7128cf522b101c97dafac270
5
5
  SHA512:
6
- metadata.gz: 50a1af6a74a494d756f19f4e600b4c10e046a57f1641b92c9895f5a54837c174015ef63d37b9a474ffbe1b631c461686490f7341fc5f28413822e498705e1a1d
7
- data.tar.gz: 6216f9a93b8727f4ceebe17c50e1e826dce5f1f8a32d16d5ceb0fe0d092e600688b81f148b08df74cf1ee50f42437c9c527cb56de3362e31b081e56cc8245c99
6
+ metadata.gz: 32aa9a72b8877b47a64c8a40fa0d0161c654e022ace8c3606fd632c7878e6c643c72fbab6b2e2afac69485d2d74446bf57bffcd0581303af2eccc21c7dd717ad
7
+ data.tar.gz: 1c810a954468888c942aa4fb0f2faff97680cb1efd3864ed069bd51aedc9c542b4fb588f5c6f33e600ece802b36deeb90655bda6cc8171495a847de2e547e7ac
data/bin/crunch-job CHANGED
@@ -1022,7 +1022,7 @@ for (my $todo_ptr = 0; $todo_ptr <= $#jobstep_todo; $todo_ptr ++)
1022
1022
  delete $Jobstep->{tempfail};
1023
1023
 
1024
1024
  $Jobstep->{'arvados_task'}->{started_at} = strftime "%Y-%m-%dT%H:%M:%SZ", gmtime($Jobstep->{starttime});
1025
- $Jobstep->{'arvados_task'}->save;
1025
+ retry_op(sub { $Jobstep->{'arvados_task'}->save; }, "job_tasks.update API");
1026
1026
 
1027
1027
  splice @jobstep_todo, $todo_ptr, 1;
1028
1028
  --$todo_ptr;
@@ -1205,7 +1205,7 @@ sub reapchildren
1205
1205
  "ERROR: Task process exited %s, but never updated its task record to indicate success and record its output.",
1206
1206
  exit_status_s($childstatus)));
1207
1207
  $Jobstep->{'arvados_task'}->{success} = 0;
1208
- $Jobstep->{'arvados_task'}->save;
1208
+ retry_op(sub { $Jobstep->{'arvados_task'}->save; }, "job_tasks.update API");
1209
1209
  $task_success = 0;
1210
1210
  }
1211
1211
 
@@ -1258,7 +1258,7 @@ sub reapchildren
1258
1258
  $Jobstep->{exitcode} = $childstatus;
1259
1259
  $Jobstep->{finishtime} = time;
1260
1260
  $Jobstep->{'arvados_task'}->{finished_at} = strftime "%Y-%m-%dT%H:%M:%SZ", gmtime($Jobstep->{finishtime});
1261
- $Jobstep->{'arvados_task'}->save;
1261
+ retry_op(sub { $Jobstep->{'arvados_task'}->save; }, "job_tasks.update API");
1262
1262
  process_stderr_final ($jobstepidx);
1263
1263
  Log ($jobstepidx, sprintf("task output (%d bytes): %s",
1264
1264
  length($Jobstep->{'arvados_task'}->{output}),
@@ -2177,8 +2177,22 @@ sub retry_op {
2177
2177
  # that can be retried, the second function will be called with
2178
2178
  # the current try count (0-based), next try time, and error message.
2179
2179
  my $operation = shift;
2180
- my $retry_callback = shift;
2180
+ my $op_text = shift;
2181
2181
  my $retries = retry_count();
2182
+ my $retry_callback = sub {
2183
+ my ($try_count, $next_try_at, $errmsg) = @_;
2184
+ $errmsg =~ s/\s*\bat \Q$0\E line \d+\.?\s*//;
2185
+ $errmsg =~ s/\s/ /g;
2186
+ $errmsg =~ s/\s+$//;
2187
+ my $retry_msg;
2188
+ if ($next_try_at < time) {
2189
+ $retry_msg = "Retrying.";
2190
+ } else {
2191
+ my $next_try_fmt = strftime "%Y-%m-%dT%H:%M:%SZ", gmtime($next_try_at);
2192
+ $retry_msg = "Retrying at $next_try_fmt.";
2193
+ }
2194
+ Log(undef, "$op_text failed: $errmsg. $retry_msg");
2195
+ };
2182
2196
  foreach my $try_count (0..$retries) {
2183
2197
  my $next_try = time + (2 ** $try_count);
2184
2198
  my $result = eval { $operation->(@_); };
@@ -2201,25 +2215,11 @@ sub api_call {
2201
2215
  # This function will call that method, retrying as needed until
2202
2216
  # the current retry_count is exhausted, with a log on the first failure.
2203
2217
  my $method_name = shift;
2204
- my $log_api_retry = sub {
2205
- my ($try_count, $next_try_at, $errmsg) = @_;
2206
- $errmsg =~ s/\s*\bat \Q$0\E line \d+\.?\s*//;
2207
- $errmsg =~ s/\s/ /g;
2208
- $errmsg =~ s/\s+$//;
2209
- my $retry_msg;
2210
- if ($next_try_at < time) {
2211
- $retry_msg = "Retrying.";
2212
- } else {
2213
- my $next_try_fmt = strftime "%Y-%m-%dT%H:%M:%SZ", gmtime($next_try_at);
2214
- $retry_msg = "Retrying at $next_try_fmt.";
2215
- }
2216
- Log(undef, "API method $method_name failed: $errmsg. $retry_msg");
2217
- };
2218
2218
  my $method = $arv;
2219
2219
  foreach my $key (split(/\//, $method_name)) {
2220
2220
  $method = $method->{$key};
2221
2221
  }
2222
- return retry_op(sub { $method->execute(@_); }, $log_api_retry, @_);
2222
+ return retry_op(sub { $method->execute(@_); }, "API method $method_name", @_);
2223
2223
  }
2224
2224
 
2225
2225
  sub exit_status_s {
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.20170807174734
4
+ version: 0.1.20170817171636
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-08-07 00:00:00.000000000 Z
11
+ date: 2017-08-17 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 f12b4e8995e88f9763b74ad48d0618f98879a31b
167
+ description: Arvados command line tools, git commit 0b4800608e6394d66deec9cecea610c5fbbd75ad
168
168
  email: gem-dev@curoverse.com
169
169
  executables:
170
170
  - arv