@@ -207,6 +207,7 @@ sub _awe_to_task
207
207
208
208
my $task = {
209
209
id => $id ,
210
+ parent_id => $u -> {parent_task },
210
211
app => $u -> {app_id },
211
212
workspace => $u -> {workspace },
212
213
parameters => decode_json($u -> {parameters }),
@@ -368,7 +369,7 @@ sub service_status
368
369
my ($return );
369
370
# BEGIN service_status
370
371
371
- my ($stat , $txt ) = $self -> {util }-> service_status();
372
+ my ($stat , $txt ) = $self -> {util }-> service_status($ctx );
372
373
$return = [$stat , $txt ];
373
374
374
375
# END service_status
@@ -494,6 +495,7 @@ task_parameters is a reference to a hash where the key is a string and the value
494
495
workspace_id is a string
495
496
Task is a reference to a hash where the following keys are defined:
496
497
id has a value which is a task_id
498
+ parent_id has a value which is a task_id
497
499
app has a value which is an app_id
498
500
workspace has a value which is a workspace_id
499
501
parameters has a value which is a task_parameters
@@ -523,6 +525,7 @@ task_parameters is a reference to a hash where the key is a string and the value
523
525
workspace_id is a string
524
526
Task is a reference to a hash where the following keys are defined:
525
527
id has a value which is a task_id
528
+ parent_id has a value which is a task_id
526
529
app has a value which is an app_id
527
530
workspace has a value which is a workspace_id
528
531
parameters has a value which is a task_parameters
@@ -568,111 +571,127 @@ sub start_app
568
571
my ($task );
569
572
# BEGIN start_app
570
573
571
- if (!$self -> {util }-> submissions_enabled($app_id ))
572
- {
573
- die " App service submissions are disabled\n " ;
574
+ $task = $self -> {util }-> start_app($ctx , $app_id , $params , { workspace => $workspace });
575
+ # END start_app
576
+ my @_bad_returns;
577
+ (ref ($task ) eq ' HASH' ) or push (@_bad_returns, " Invalid type for return variable \" task\" (value was \" $task \" )" );
578
+ if (@_bad_returns) {
579
+ my $msg = " Invalid returns passed to start_app:\n " . join (" " , map { " \t $_ \n " } @_bad_returns);
580
+ die $msg ;
574
581
}
582
+ return ($task );
583
+ }
575
584
576
- my $json = JSON::XS-> new-> ascii-> pretty(1);
577
585
578
- #
579
- # Create a new workflow for this task.
580
- #
581
586
582
- my $app = $self -> {util }-> find_app($app_id );
583
587
584
- if (!$app )
585
- {
586
- die " Could not find app for id $app_id \n " ;
587
- }
588
+ =head2 start_app2
588
589
589
- my $awe = Bio::KBase::AppService::Awe -> new( $self -> { awe_server } , $ctx -> token);
590
+ $task = $obj->start_app2($app_id , $params, $start_params)
590
591
591
- my $param_str = $json -> encode( $params );
592
+ =over 4
592
593
593
- #
594
- # Create an identifier we can use to match the Shock nodes we create for this
595
- # job with the job itself.
596
- #
594
+ =item Parameter and return types
597
595
598
- my $gen = Data::UUID-> new;
599
- my $task_file_uuid = $gen -> create();
600
- my $task_file_id = lc ($gen -> to_string($task_file_uuid ));
596
+ =begin html
601
597
602
- my $userattr = {
603
- app_id => $app_id ,
604
- parameters => $param_str ,
605
- workspace => $workspace ,
606
- task_file_id => $task_file_id ,
607
- };
598
+ <pre >
599
+ $app_id is an app_id
600
+ $params is a task_parameters
601
+ $start_params is a StartParams
602
+ $task is a Task
603
+ app_id is a string
604
+ task_parameters is a reference to a hash where the key is a string and the value is a string
605
+ StartParams is a reference to a hash where the following keys are defined:
606
+ parent_id has a value which is a task_id
607
+ workspace has a value which is a workspace_id
608
+ task_id is a string
609
+ workspace_id is a string
610
+ Task is a reference to a hash where the following keys are defined:
611
+ id has a value which is a task_id
612
+ parent_id has a value which is a task_id
613
+ app has a value which is an app_id
614
+ workspace has a value which is a workspace_id
615
+ parameters has a value which is a task_parameters
616
+ user_id has a value which is a string
617
+ status has a value which is a task_status
618
+ awe_status has a value which is a task_status
619
+ submit_time has a value which is a string
620
+ start_time has a value which is a string
621
+ completed_time has a value which is a string
622
+ stdout_shock_node has a value which is a string
623
+ stderr_shock_node has a value which is a string
624
+ task_status is a string
608
625
609
- my $clientgroup = $self -> { awe_clientgroup };
626
+ </ pre >
610
627
611
- if ($app_id eq ' MetagenomeBinning' && $params -> {contigs })
612
- {
613
- # Hack to send contigs-only jobs to a different clientgroup
614
- $clientgroup .= " -fast" ;
615
- print STDERR " Redirecting job to fast queue\n " . Dumper($params );
616
- }
617
- if ($params -> {_clientgroup })
618
- {
619
- $clientgroup = $params -> {_clientgroup };
628
+ =end html
629
+
630
+ =begin text
631
+
632
+ $app_id is an app_id
633
+ $params is a task_parameters
634
+ $start_params is a StartParams
635
+ $task is a Task
636
+ app_id is a string
637
+ task_parameters is a reference to a hash where the key is a string and the value is a string
638
+ StartParams is a reference to a hash where the following keys are defined:
639
+ parent_id has a value which is a task_id
640
+ workspace has a value which is a workspace_id
641
+ task_id is a string
642
+ workspace_id is a string
643
+ Task is a reference to a hash where the following keys are defined:
644
+ id has a value which is a task_id
645
+ parent_id has a value which is a task_id
646
+ app has a value which is an app_id
647
+ workspace has a value which is a workspace_id
648
+ parameters has a value which is a task_parameters
649
+ user_id has a value which is a string
650
+ status has a value which is a task_status
651
+ awe_status has a value which is a task_status
652
+ submit_time has a value which is a string
653
+ start_time has a value which is a string
654
+ completed_time has a value which is a string
655
+ stdout_shock_node has a value which is a string
656
+ stderr_shock_node has a value which is a string
657
+ task_status is a string
658
+
659
+
660
+ =end text
661
+
662
+
663
+
664
+ =item Description
665
+
666
+
667
+
668
+ =back
669
+
670
+ =cut
671
+
672
+ sub start_app2
673
+ {
674
+ my $self = shift ;
675
+ my ($app_id , $params , $start_params ) = @_ ;
676
+
677
+ my @_bad_arguments;
678
+ (!ref ($app_id )) or push (@_bad_arguments, " Invalid type for argument \" app_id\" (value was \" $app_id \" )" );
679
+ (ref ($params ) eq ' HASH' ) or push (@_bad_arguments, " Invalid type for argument \" params\" (value was \" $params \" )" );
680
+ (ref ($start_params ) eq ' HASH' ) or push (@_bad_arguments, " Invalid type for argument \" start_params\" (value was \" $start_params \" )" );
681
+ if (@_bad_arguments) {
682
+ my $msg = " Invalid arguments passed to start_app2:\n " . join (" " , map { " \t $_ \n " } @_bad_arguments);
683
+ die $msg ;
620
684
}
621
-
622
- my $job = $awe -> create_job_description(pipeline => ' AppService' ,
623
- name => $app_id ,
624
- project => ' AppService' ,
625
- user => $ctx -> user_id,
626
- clientgroups => $clientgroup ,
627
- userattr => $userattr ,
628
- priority => 2,
629
- );
630
-
631
- my $shock = Bio::KBase::AppService::Shock-> new($self -> {shock_server }, $ctx -> token);
632
- $shock -> tag_nodes(task_file_id => $task_file_id ,
633
- app_id => $app_id );
634
- my $params_node_id = $shock -> put_file_data($param_str , " params" );
635
-
636
- my $app_node_id = $shock -> put_file_data($json -> encode($app ), " app" );
637
-
638
- my $app_file = $awe -> create_job_file(" app" , $shock -> server, $app_node_id );
639
- my $params_file = $awe -> create_job_file(" params" , $shock -> server, $params_node_id );
640
-
641
- # my $stdout_file = $awe->create_job_file("stdout.txt", $shock->server);
642
- # my $stderr_file = $awe->create_job_file("stderr.txt", $shock->server);
643
-
644
- my $awe_stdout_file = $awe -> create_job_file(" awe_stdout.txt" , $shock -> server);
645
- my $awe_stderr_file = $awe -> create_job_file(" awe_stderr.txt" , $shock -> server);
646
-
647
- my $appserv_info_url = " $self ->{service_url}/task_info" ;
648
-
649
- my $task_userattr = {};
650
- my $task_id = $job -> add_task($app -> {script },
651
- $app -> {script },
652
- join (" " ,
653
- $appserv_info_url ,
654
- $app_file -> in_name, $params_file -> in_name,
655
- # $stdout_file->name, $stderr_file->name,
656
- ),
657
- [],
658
- [$app_file , $params_file ],
659
- [$awe_stdout_file , $awe_stderr_file ],
660
- # [$stdout_file, $stderr_file, $awe_stdout_file, $awe_stderr_file],
661
- undef ,
662
- undef ,
663
- $task_userattr ,
664
- );
665
-
666
- # print STDERR Dumper($job);
667
-
668
- my $task_id = $awe -> submit($job );
669
-
670
- $task = $self -> _lookup_task($awe , $task_id );
671
- # END start_app
685
+
686
+ my $ctx = $Bio::KBase::AppService::Service::CallContext ;
687
+ my ($task );
688
+ # BEGIN start_app2
689
+ $task = $self -> {util }-> start_app($ctx , $app_id , $params , $start_params );
690
+ # END start_app2
672
691
my @_bad_returns;
673
692
(ref ($task ) eq ' HASH' ) or push (@_bad_returns, " Invalid type for return variable \" task\" (value was \" $task \" )" );
674
693
if (@_bad_returns) {
675
- my $msg = " Invalid returns passed to start_app :\n " . join (" " , map { " \t $_ \n " } @_bad_returns);
694
+ my $msg = " Invalid returns passed to start_app2 :\n " . join (" " , map { " \t $_ \n " } @_bad_returns);
676
695
die $msg ;
677
696
}
678
697
return ($task );
@@ -697,6 +716,7 @@ $tasks is a reference to a hash where the key is a task_id and the value is a Ta
697
716
task_id is a string
698
717
Task is a reference to a hash where the following keys are defined:
699
718
id has a value which is a task_id
719
+ parent_id has a value which is a task_id
700
720
app has a value which is an app_id
701
721
workspace has a value which is a workspace_id
702
722
parameters has a value which is a task_parameters
@@ -724,6 +744,7 @@ $tasks is a reference to a hash where the key is a task_id and the value is a Ta
724
744
task_id is a string
725
745
Task is a reference to a hash where the following keys are defined:
726
746
id has a value which is a task_id
747
+ parent_id has a value which is a task_id
727
748
app has a value which is an app_id
728
749
workspace has a value which is a workspace_id
729
750
parameters has a value which is a task_parameters
@@ -1001,6 +1022,7 @@ $count is an int
1001
1022
$return is a reference to a list where each element is a Task
1002
1023
Task is a reference to a hash where the following keys are defined:
1003
1024
id has a value which is a task_id
1025
+ parent_id has a value which is a task_id
1004
1026
app has a value which is an app_id
1005
1027
workspace has a value which is a workspace_id
1006
1028
parameters has a value which is a task_parameters
@@ -1029,6 +1051,7 @@ $count is an int
1029
1051
$return is a reference to a list where each element is a Task
1030
1052
Task is a reference to a hash where the following keys are defined:
1031
1053
id has a value which is a task_id
1054
+ parent_id has a value which is a task_id
1032
1055
app has a value which is an app_id
1033
1056
workspace has a value which is a workspace_id
1034
1057
parameters has a value which is a task_parameters
@@ -1561,6 +1584,7 @@ a string
1561
1584
<pre >
1562
1585
a reference to a hash where the following keys are defined:
1563
1586
id has a value which is a task_id
1587
+ parent_id has a value which is a task_id
1564
1588
app has a value which is an app_id
1565
1589
workspace has a value which is a workspace_id
1566
1590
parameters has a value which is a task_parameters
@@ -1581,6 +1605,7 @@ stderr_shock_node has a value which is a string
1581
1605
1582
1606
a reference to a hash where the following keys are defined:
1583
1607
id has a value which is a task_id
1608
+ parent_id has a value which is a task_id
1584
1609
app has a value which is an app_id
1585
1610
workspace has a value which is a workspace_id
1586
1611
parameters has a value which is a task_parameters
@@ -1650,6 +1675,38 @@ output_files has a value which is a reference to a list where each element is a
1650
1675
1651
1676
1652
1677
1678
+ =head2 StartParams
1679
+
1680
+ =over 4
1681
+
1682
+
1683
+
1684
+ =item Definition
1685
+
1686
+ =begin html
1687
+
1688
+ <pre >
1689
+ a reference to a hash where the following keys are defined:
1690
+ parent_id has a value which is a task_id
1691
+ workspace has a value which is a workspace_id
1692
+
1693
+ </pre >
1694
+
1695
+ =end html
1696
+
1697
+ =begin text
1698
+
1699
+ a reference to a hash where the following keys are defined:
1700
+ parent_id has a value which is a task_id
1701
+ workspace has a value which is a workspace_id
1702
+
1703
+
1704
+ =end text
1705
+
1706
+ =back
1707
+
1708
+
1709
+
1653
1710
=head2 TaskDetails
1654
1711
1655
1712
=over 4
0 commit comments