6
6
7
7
from .state import ApplicationState
8
8
9
- from app_pack_generator import GitManager , DockerUtil , ApplicationNotebook , CWL , Descriptor
9
+ from app_pack_generator import GitManager , DockerUtil , ApplicationNotebook
10
+ from app_pack_generator import ProcessCWL , DataStagingCWL , Descriptor
10
11
11
12
from unity_sds_client .services .application_service import DockstoreAppCatalog
12
13
@@ -55,9 +56,9 @@ def push_to_docker_registry(self, docker_registry, image_tag=None):
55
56
# Push to remote repository
56
57
self .app_state .docker_url = self .docker_util .push_image (docker_registry , self .app_state .docker_image_tag )
57
58
58
- def _generate_dockstore_cwl (self , cwl_output_path ):
59
+ def _generate_dockstore_cwl (self , cwl_output_path , target_cwl_filename ):
59
60
60
- template = """
61
+ template = f """
61
62
cwlVersion: v1.0
62
63
63
64
class: Workflow
@@ -66,14 +67,15 @@ def _generate_dockstore_cwl(self, cwl_output_path):
66
67
67
68
steps:
68
69
step:
69
- run: workflow.cwl
70
+ run: { target_cwl_filename }
70
71
"""
72
+
71
73
# Hard code file name because it is a hard coded re
72
74
dockstore_cwl_filename = os .path .join (cwl_output_path , "Dockstore.cwl" )
73
75
with open (dockstore_cwl_filename , "w" ) as cwl_file :
74
76
cwl_file .write (template .lstrip ())
75
77
76
- def create_cwl (self , cwl_output_path = None , docker_url = None ):
78
+ def create_cwl (self , cwl_output_path = None , docker_url = None , monolithic = False ):
77
79
78
80
# Fall through using docker_image_tag if docker_url does not exist because no push has occurred
79
81
# Or if docker_url is supplied as an argument use that
@@ -99,14 +101,26 @@ def create_cwl(self, cwl_output_path=None, docker_url=None):
99
101
app = ApplicationNotebook (notebook_filename )
100
102
101
103
logger .info ("Parameters:\n " + app .parameter_summary ())
104
+
105
+ # Create CWL files depending on the mode of production
106
+ cwl_generators = [ ProcessCWL (app ) ]
102
107
103
- cwl = CWL ( app )
104
- desc = Descriptor ( app , self . repo_info )
108
+ if monolithic :
109
+ cwl_generators . append ( DataStagingCWL ( app ) )
105
110
106
- files = cwl .generate_all (cwl_output_path , docker_url )
107
- files .append (desc .generate_descriptor (cwl_output_path , docker_url ))
111
+ files_created = []
112
+ for cwl_gen in cwl_generators :
113
+ files_created += cwl_gen .generate_all (cwl_output_path , dockerurl = docker_url )
114
+
115
+ # Add the JSON descriptor file
116
+ desc = Descriptor (app , self .repo_info )
117
+ files_created .append (desc .generate_descriptor (cwl_output_path , docker_url ))
108
118
109
- self ._generate_dockstore_cwl (cwl_output_path )
119
+ # Add Dockstore.cwl, point it to the appropriate entry point
120
+ if monolithic :
121
+ self ._generate_dockstore_cwl (cwl_output_path , "workflow.cwl" )
122
+ else :
123
+ self ._generate_dockstore_cwl (cwl_output_path , "process.cwl" )
110
124
111
125
def notebook_parameters (self ):
112
126
0 commit comments