forked from kbaseattic/dev_container
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient.txt
More file actions
1555 lines (1091 loc) · 33.3 KB
/
Client.txt
File metadata and controls
1555 lines (1091 loc) · 33.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package Bio::KBase::AppService::Client;
use POSIX;
use strict;
use Data::Dumper;
use URI;
my $get_time = sub { time, 0 };
eval {
require Time::HiRes;
$get_time = sub { Time::HiRes::gettimeofday() };
};
use P3AuthToken;
=head1 NAME
Bio::KBase::AppService::Client
=head1 DESCRIPTION
=cut
sub new
{
my($class, $url, @args) = @_;
if (!defined($url))
{
$url = 'https://p3.theseed.org/services/app_service';
}
my $self = {
client => Bio::KBase::AppService::Client::RpcClient->new,
url => $url,
headers => [],
};
chomp($self->{hostname} = `hostname`);
$self->{hostname} ||= 'unknown-host';
#
# Set up for propagating KBRPC_TAG and KBRPC_METADATA environment variables through
# to invoked services. If these values are not set, we create a new tag
# and a metadata field with basic information about the invoking script.
#
if ($ENV{KBRPC_TAG})
{
$self->{kbrpc_tag} = $ENV{KBRPC_TAG};
}
else
{
my ($t, $us) = &$get_time();
$us = sprintf("%06d", $us);
my $ts = strftime("%Y-%m-%dT%H:%M:%S.${us}Z", gmtime $t);
$self->{kbrpc_tag} = "C:$0:$self->{hostname}:$$:$ts";
}
push(@{$self->{headers}}, 'Kbrpc-Tag', $self->{kbrpc_tag});
if ($ENV{KBRPC_METADATA})
{
$self->{kbrpc_metadata} = $ENV{KBRPC_METADATA};
push(@{$self->{headers}}, 'Kbrpc-Metadata', $self->{kbrpc_metadata});
}
if ($ENV{KBRPC_ERROR_DEST})
{
$self->{kbrpc_error_dest} = $ENV{KBRPC_ERROR_DEST};
push(@{$self->{headers}}, 'Kbrpc-Errordest', $self->{kbrpc_error_dest});
}
#
# This module requires authentication.
#
# We create an auth token, passing through the arguments that we were (hopefully) given.
{
my $token = P3AuthToken->new(@args);
if (my $token_str = $token->token())
{
$self->{token} = $token_str;
$self->{client}->{token} = $token_str;
}
else
{
#
# All methods in this module require authentication. In this case, if we
# don't have a token, we can't continue.
#
die "Authentication failed\n";
}
}
my $ua = $self->{client}->ua;
my $timeout = $ENV{CDMI_TIMEOUT} || (30 * 60);
$ua->timeout($timeout);
$ua->agent("Bio::KBase::AppService::Client UserAgent");
bless $self, $class;
return $self;
}
=head2 service_status
$return = $obj->service_status()
=over 4
=item Parameter and return types
=begin html
<pre>
$return is a reference to a list containing 2 items:
0: (submission_enabled) an int
1: (status_message) a string
</pre>
=end html
=begin text
$return is a reference to a list containing 2 items:
0: (submission_enabled) an int
1: (status_message) a string
=end text
=item Description
=back
=cut
sub service_status
{
my($self, @args) = @_;
# Authentication: required
if ((my $n = @args) != 0)
{
die "Invalid argument count for function service_status (received $n, expecting 0)";
}
my $result = $self->{client}->call($self->{url}, $self->{headers}, {
method => "AppService.service_status",
params => \@args,
});
if ($result) {
if ($result->{error}) {
my $msg = $result->{error}->{error} || $result->{error}->{message};
$msg = $self->{client}->json->encode($msg) if ref($msg);
die "Error $result->{error}->{code} invoking service_status:\n$msg\n";
} else {
return wantarray ? @{$result->{result}} : $result->{result}->[0];
}
} else {
die "Error invoking method service_status: " . $self->{client}->status_line;
}
}
=head2 enumerate_apps
$return = $obj->enumerate_apps()
=over 4
=item Parameter and return types
=begin html
<pre>
$return is a reference to a list where each element is an App
App is a reference to a hash where the following keys are defined:
id has a value which is an app_id
script has a value which is a string
label has a value which is a string
description has a value which is a string
parameters has a value which is a reference to a list where each element is an AppParameter
app_id is a string
AppParameter is a reference to a hash where the following keys are defined:
id has a value which is a string
label has a value which is a string
required has a value which is an int
default has a value which is a string
desc has a value which is a string
type has a value which is a string
enum has a value which is a string
wstype has a value which is a string
</pre>
=end html
=begin text
$return is a reference to a list where each element is an App
App is a reference to a hash where the following keys are defined:
id has a value which is an app_id
script has a value which is a string
label has a value which is a string
description has a value which is a string
parameters has a value which is a reference to a list where each element is an AppParameter
app_id is a string
AppParameter is a reference to a hash where the following keys are defined:
id has a value which is a string
label has a value which is a string
required has a value which is an int
default has a value which is a string
desc has a value which is a string
type has a value which is a string
enum has a value which is a string
wstype has a value which is a string
=end text
=item Description
=back
=cut
sub enumerate_apps
{
my($self, @args) = @_;
# Authentication: required
if ((my $n = @args) != 0)
{
die "Invalid argument count for function enumerate_apps (received $n, expecting 0)";
}
my $result = $self->{client}->call($self->{url}, $self->{headers}, {
method => "AppService.enumerate_apps",
params => \@args,
});
if ($result) {
if ($result->{error}) {
my $msg = $result->{error}->{error} || $result->{error}->{message};
$msg = $self->{client}->json->encode($msg) if ref($msg);
die "Error $result->{error}->{code} invoking enumerate_apps:\n$msg\n";
} else {
return wantarray ? @{$result->{result}} : $result->{result}->[0];
}
} else {
die "Error invoking method enumerate_apps: " . $self->{client}->status_line;
}
}
=head2 start_app
$task = $obj->start_app($app_id, $params, $workspace)
=over 4
=item Parameter and return types
=begin html
<pre>
$app_id is an app_id
$params is a task_parameters
$workspace is a workspace_id
$task is a Task
app_id is a string
task_parameters is a reference to a hash where the key is a string and the value is a string
workspace_id is a string
Task is a reference to a hash where the following keys are defined:
id has a value which is a task_id
parent_id has a value which is a task_id
app has a value which is an app_id
workspace has a value which is a workspace_id
parameters has a value which is a task_parameters
user_id has a value which is a string
status has a value which is a task_status
awe_status has a value which is a task_status
submit_time has a value which is a string
start_time has a value which is a string
completed_time has a value which is a string
stdout_shock_node has a value which is a string
stderr_shock_node has a value which is a string
task_id is a string
task_status is a string
</pre>
=end html
=begin text
$app_id is an app_id
$params is a task_parameters
$workspace is a workspace_id
$task is a Task
app_id is a string
task_parameters is a reference to a hash where the key is a string and the value is a string
workspace_id is a string
Task is a reference to a hash where the following keys are defined:
id has a value which is a task_id
parent_id has a value which is a task_id
app has a value which is an app_id
workspace has a value which is a workspace_id
parameters has a value which is a task_parameters
user_id has a value which is a string
status has a value which is a task_status
awe_status has a value which is a task_status
submit_time has a value which is a string
start_time has a value which is a string
completed_time has a value which is a string
stdout_shock_node has a value which is a string
stderr_shock_node has a value which is a string
task_id is a string
task_status is a string
=end text
=item Description
=back
=cut
sub start_app
{
my($self, @args) = @_;
# Authentication: required
if ((my $n = @args) != 3)
{
die "Invalid argument count for function start_app (received $n, expecting 3)";
}
{
my($app_id, $params, $workspace) = @args;
my @_bad_arguments;
(!ref($app_id)) or push(@_bad_arguments, "Invalid type for argument 1 \"app_id\" (value was \"$app_id\")");
(ref($params) eq 'HASH') or push(@_bad_arguments, "Invalid type for argument 2 \"params\" (value was \"$params\")");
(!ref($workspace)) or push(@_bad_arguments, "Invalid type for argument 3 \"workspace\" (value was \"$workspace\")");
if (@_bad_arguments) {
my $msg = "Invalid arguments passed to start_app:\n" . join("", map { "\t$_\n" } @_bad_arguments);
die $msg;
}
}
my $result = $self->{client}->call($self->{url}, $self->{headers}, {
method => "AppService.start_app",
params => \@args,
});
if ($result) {
if ($result->{error}) {
my $msg = $result->{error}->{error} || $result->{error}->{message};
$msg = $self->{client}->json->encode($msg) if ref($msg);
die "Error $result->{error}->{code} invoking start_app:\n$msg\n";
} else {
return wantarray ? @{$result->{result}} : $result->{result}->[0];
}
} else {
die "Error invoking method start_app: " . $self->{client}->status_line;
}
}
=head2 start_app2
$task = $obj->start_app2($app_id, $params, $start_params)
=over 4
=item Parameter and return types
=begin html
<pre>
$app_id is an app_id
$params is a task_parameters
$start_params is a StartParams
$task is a Task
app_id is a string
task_parameters is a reference to a hash where the key is a string and the value is a string
StartParams is a reference to a hash where the following keys are defined:
parent_id has a value which is a task_id
workspace has a value which is a workspace_id
task_id is a string
workspace_id is a string
Task is a reference to a hash where the following keys are defined:
id has a value which is a task_id
parent_id has a value which is a task_id
app has a value which is an app_id
workspace has a value which is a workspace_id
parameters has a value which is a task_parameters
user_id has a value which is a string
status has a value which is a task_status
awe_status has a value which is a task_status
submit_time has a value which is a string
start_time has a value which is a string
completed_time has a value which is a string
stdout_shock_node has a value which is a string
stderr_shock_node has a value which is a string
task_status is a string
</pre>
=end html
=begin text
$app_id is an app_id
$params is a task_parameters
$start_params is a StartParams
$task is a Task
app_id is a string
task_parameters is a reference to a hash where the key is a string and the value is a string
StartParams is a reference to a hash where the following keys are defined:
parent_id has a value which is a task_id
workspace has a value which is a workspace_id
task_id is a string
workspace_id is a string
Task is a reference to a hash where the following keys are defined:
id has a value which is a task_id
parent_id has a value which is a task_id
app has a value which is an app_id
workspace has a value which is a workspace_id
parameters has a value which is a task_parameters
user_id has a value which is a string
status has a value which is a task_status
awe_status has a value which is a task_status
submit_time has a value which is a string
start_time has a value which is a string
completed_time has a value which is a string
stdout_shock_node has a value which is a string
stderr_shock_node has a value which is a string
task_status is a string
=end text
=item Description
=back
=cut
sub start_app2
{
my($self, @args) = @_;
# Authentication: required
if ((my $n = @args) != 3)
{
die "Invalid argument count for function start_app2 (received $n, expecting 3)";
}
{
my($app_id, $params, $start_params) = @args;
my @_bad_arguments;
(!ref($app_id)) or push(@_bad_arguments, "Invalid type for argument 1 \"app_id\" (value was \"$app_id\")");
(ref($params) eq 'HASH') or push(@_bad_arguments, "Invalid type for argument 2 \"params\" (value was \"$params\")");
(ref($start_params) eq 'HASH') or push(@_bad_arguments, "Invalid type for argument 3 \"start_params\" (value was \"$start_params\")");
if (@_bad_arguments) {
my $msg = "Invalid arguments passed to start_app2:\n" . join("", map { "\t$_\n" } @_bad_arguments);
die $msg;
}
}
my $result = $self->{client}->call($self->{url}, $self->{headers}, {
method => "AppService.start_app2",
params => \@args,
});
if ($result) {
if ($result->{error}) {
my $msg = $result->{error}->{error} || $result->{error}->{message};
$msg = $self->{client}->json->encode($msg) if ref($msg);
die "Error $result->{error}->{code} invoking start_app2:\n$msg\n";
} else {
return wantarray ? @{$result->{result}} : $result->{result}->[0];
}
} else {
die "Error invoking method start_app2: " . $self->{client}->status_line;
}
}
=head2 query_tasks
$tasks = $obj->query_tasks($task_ids)
=over 4
=item Parameter and return types
=begin html
<pre>
$task_ids is a reference to a list where each element is a task_id
$tasks is a reference to a hash where the key is a task_id and the value is a Task
task_id is a string
Task is a reference to a hash where the following keys are defined:
id has a value which is a task_id
parent_id has a value which is a task_id
app has a value which is an app_id
workspace has a value which is a workspace_id
parameters has a value which is a task_parameters
user_id has a value which is a string
status has a value which is a task_status
awe_status has a value which is a task_status
submit_time has a value which is a string
start_time has a value which is a string
completed_time has a value which is a string
stdout_shock_node has a value which is a string
stderr_shock_node has a value which is a string
app_id is a string
workspace_id is a string
task_parameters is a reference to a hash where the key is a string and the value is a string
task_status is a string
</pre>
=end html
=begin text
$task_ids is a reference to a list where each element is a task_id
$tasks is a reference to a hash where the key is a task_id and the value is a Task
task_id is a string
Task is a reference to a hash where the following keys are defined:
id has a value which is a task_id
parent_id has a value which is a task_id
app has a value which is an app_id
workspace has a value which is a workspace_id
parameters has a value which is a task_parameters
user_id has a value which is a string
status has a value which is a task_status
awe_status has a value which is a task_status
submit_time has a value which is a string
start_time has a value which is a string
completed_time has a value which is a string
stdout_shock_node has a value which is a string
stderr_shock_node has a value which is a string
app_id is a string
workspace_id is a string
task_parameters is a reference to a hash where the key is a string and the value is a string
task_status is a string
=end text
=item Description
=back
=cut
sub query_tasks
{
my($self, @args) = @_;
# Authentication: required
if ((my $n = @args) != 1)
{
die "Invalid argument count for function query_tasks (received $n, expecting 1)";
}
{
my($task_ids) = @args;
my @_bad_arguments;
(ref($task_ids) eq 'ARRAY') or push(@_bad_arguments, "Invalid type for argument 1 \"task_ids\" (value was \"$task_ids\")");
if (@_bad_arguments) {
my $msg = "Invalid arguments passed to query_tasks:\n" . join("", map { "\t$_\n" } @_bad_arguments);
die $msg;
}
}
my $result = $self->{client}->call($self->{url}, $self->{headers}, {
method => "AppService.query_tasks",
params => \@args,
});
if ($result) {
if ($result->{error}) {
my $msg = $result->{error}->{error} || $result->{error}->{message};
$msg = $self->{client}->json->encode($msg) if ref($msg);
die "Error $result->{error}->{code} invoking query_tasks:\n$msg\n";
} else {
return wantarray ? @{$result->{result}} : $result->{result}->[0];
}
} else {
die "Error invoking method query_tasks: " . $self->{client}->status_line;
}
}
=head2 query_task_summary
$status = $obj->query_task_summary()
=over 4
=item Parameter and return types
=begin html
<pre>
$status is a reference to a hash where the key is a task_status and the value is an int
task_status is a string
</pre>
=end html
=begin text
$status is a reference to a hash where the key is a task_status and the value is an int
task_status is a string
=end text
=item Description
=back
=cut
sub query_task_summary
{
my($self, @args) = @_;
# Authentication: required
if ((my $n = @args) != 0)
{
die "Invalid argument count for function query_task_summary (received $n, expecting 0)";
}
my $result = $self->{client}->call($self->{url}, $self->{headers}, {
method => "AppService.query_task_summary",
params => \@args,
});
if ($result) {
if ($result->{error}) {
my $msg = $result->{error}->{error} || $result->{error}->{message};
$msg = $self->{client}->json->encode($msg) if ref($msg);
die "Error $result->{error}->{code} invoking query_task_summary:\n$msg\n";
} else {
return wantarray ? @{$result->{result}} : $result->{result}->[0];
}
} else {
die "Error invoking method query_task_summary: " . $self->{client}->status_line;
}
}
=head2 query_task_details
$details = $obj->query_task_details($task_id)
=over 4
=item Parameter and return types
=begin html
<pre>
$task_id is a task_id
$details is a TaskDetails
task_id is a string
TaskDetails is a reference to a hash where the following keys are defined:
stdout_url has a value which is a string
stderr_url has a value which is a string
pid has a value which is an int
hostname has a value which is a string
exitcode has a value which is an int
</pre>
=end html
=begin text
$task_id is a task_id
$details is a TaskDetails
task_id is a string
TaskDetails is a reference to a hash where the following keys are defined:
stdout_url has a value which is a string
stderr_url has a value which is a string
pid has a value which is an int
hostname has a value which is a string
exitcode has a value which is an int
=end text
=item Description
=back
=cut
sub query_task_details
{
my($self, @args) = @_;
# Authentication: required
if ((my $n = @args) != 1)
{
die "Invalid argument count for function query_task_details (received $n, expecting 1)";
}
{
my($task_id) = @args;
my @_bad_arguments;
(!ref($task_id)) or push(@_bad_arguments, "Invalid type for argument 1 \"task_id\" (value was \"$task_id\")");
if (@_bad_arguments) {
my $msg = "Invalid arguments passed to query_task_details:\n" . join("", map { "\t$_\n" } @_bad_arguments);
die $msg;
}
}
my $result = $self->{client}->call($self->{url}, $self->{headers}, {
method => "AppService.query_task_details",
params => \@args,
});
if ($result) {
if ($result->{error}) {
my $msg = $result->{error}->{error} || $result->{error}->{message};
$msg = $self->{client}->json->encode($msg) if ref($msg);
die "Error $result->{error}->{code} invoking query_task_details:\n$msg\n";
} else {
return wantarray ? @{$result->{result}} : $result->{result}->[0];
}
} else {
die "Error invoking method query_task_details: " . $self->{client}->status_line;
}
}
=head2 enumerate_tasks
$return = $obj->enumerate_tasks($offset, $count)
=over 4
=item Parameter and return types
=begin html
<pre>
$offset is an int
$count is an int
$return is a reference to a list where each element is a Task
Task is a reference to a hash where the following keys are defined:
id has a value which is a task_id
parent_id has a value which is a task_id
app has a value which is an app_id
workspace has a value which is a workspace_id
parameters has a value which is a task_parameters
user_id has a value which is a string
status has a value which is a task_status
awe_status has a value which is a task_status
submit_time has a value which is a string
start_time has a value which is a string
completed_time has a value which is a string
stdout_shock_node has a value which is a string
stderr_shock_node has a value which is a string
task_id is a string
app_id is a string
workspace_id is a string
task_parameters is a reference to a hash where the key is a string and the value is a string
task_status is a string
</pre>
=end html
=begin text
$offset is an int
$count is an int
$return is a reference to a list where each element is a Task
Task is a reference to a hash where the following keys are defined:
id has a value which is a task_id
parent_id has a value which is a task_id
app has a value which is an app_id
workspace has a value which is a workspace_id
parameters has a value which is a task_parameters
user_id has a value which is a string
status has a value which is a task_status
awe_status has a value which is a task_status
submit_time has a value which is a string
start_time has a value which is a string
completed_time has a value which is a string
stdout_shock_node has a value which is a string
stderr_shock_node has a value which is a string
task_id is a string
app_id is a string
workspace_id is a string
task_parameters is a reference to a hash where the key is a string and the value is a string
task_status is a string
=end text
=item Description
=back
=cut
sub enumerate_tasks
{
my($self, @args) = @_;
# Authentication: required
if ((my $n = @args) != 2)
{
die "Invalid argument count for function enumerate_tasks (received $n, expecting 2)";
}
{
my($offset, $count) = @args;
my @_bad_arguments;
(!ref($offset)) or push(@_bad_arguments, "Invalid type for argument 1 \"offset\" (value was \"$offset\")");
(!ref($count)) or push(@_bad_arguments, "Invalid type for argument 2 \"count\" (value was \"$count\")");
if (@_bad_arguments) {
my $msg = "Invalid arguments passed to enumerate_tasks:\n" . join("", map { "\t$_\n" } @_bad_arguments);
die $msg;
}
}
my $result = $self->{client}->call($self->{url}, $self->{headers}, {
method => "AppService.enumerate_tasks",
params => \@args,
});
if ($result) {
if ($result->{error}) {
my $msg = $result->{error}->{error} || $result->{error}->{message};
$msg = $self->{client}->json->encode($msg) if ref($msg);
die "Error $result->{error}->{code} invoking enumerate_tasks:\n$msg\n";
} else {
return wantarray ? @{$result->{result}} : $result->{result}->[0];
}
} else {
die "Error invoking method enumerate_tasks: " . $self->{client}->status_line;
}
}
=head2 kill_task
$killed, $msg = $obj->kill_task($id)
=over 4
=item Parameter and return types
=begin html
<pre>
$id is a task_id
$killed is an int
$msg is a string
task_id is a string
</pre>
=end html
=begin text
$id is a task_id
$killed is an int
$msg is a string
task_id is a string
=end text
=item Description
=back
=cut
sub kill_task
{
my($self, @args) = @_;
# Authentication: required
if ((my $n = @args) != 1)
{
die "Invalid argument count for function kill_task (received $n, expecting 1)";
}
{
my($id) = @args;
my @_bad_arguments;
(!ref($id)) or push(@_bad_arguments, "Invalid type for argument 1 \"id\" (value was \"$id\")");
if (@_bad_arguments) {
my $msg = "Invalid arguments passed to kill_task:\n" . join("", map { "\t$_\n" } @_bad_arguments);
die $msg;
}
}
my $result = $self->{client}->call($self->{url}, $self->{headers}, {
method => "AppService.kill_task",
params => \@args,
});
if ($result) {
if ($result->{error}) {
my $msg = $result->{error}->{error} || $result->{error}->{message};
$msg = $self->{client}->json->encode($msg) if ref($msg);
die "Error $result->{error}->{code} invoking kill_task:\n$msg\n";
} else {
return wantarray ? @{$result->{result}} : $result->{result}->[0];
}
} else {
die "Error invoking method kill_task: " . $self->{client}->status_line;
}
}
=head2 rerun_task
$new_task = $obj->rerun_task($id)
=over 4
=item Parameter and return types
=begin html
<pre>
$id is a task_id
$new_task is a task_id
task_id is a string
</pre>
=end html
=begin text
$id is a task_id
$new_task is a task_id
task_id is a string
=end text
=item Description