66
77from .state import ApplicationState
88
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
1011
1112from unity_sds_client .services .application_service import DockstoreAppCatalog
1213
@@ -55,9 +56,9 @@ def push_to_docker_registry(self, docker_registry, image_tag=None):
5556 # Push to remote repository
5657 self .app_state .docker_url = self .docker_util .push_image (docker_registry , self .app_state .docker_image_tag )
5758
58- def _generate_dockstore_cwl (self , cwl_output_path ):
59+ def _generate_dockstore_cwl (self , cwl_output_path , target_cwl_filename ):
5960
60- template = """
61+ template = f """
6162cwlVersion: v1.0
6263
6364class: Workflow
@@ -66,14 +67,15 @@ def _generate_dockstore_cwl(self, cwl_output_path):
6667
6768steps:
6869step:
69- run: workflow.cwl
70+ run: { target_cwl_filename }
7071"""
72+
7173 # Hard code file name because it is a hard coded re
7274 dockstore_cwl_filename = os .path .join (cwl_output_path , "Dockstore.cwl" )
7375 with open (dockstore_cwl_filename , "w" ) as cwl_file :
7476 cwl_file .write (template .lstrip ())
7577
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 ):
7779
7880 # Fall through using docker_image_tag if docker_url does not exist because no push has occurred
7981 # 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):
99101 app = ApplicationNotebook (notebook_filename )
100102
101103 logger .info ("Parameters:\n " + app .parameter_summary ())
104+
105+ # Create CWL files depending on the mode of production
106+ cwl_generators = [ ProcessCWL (app ) ]
102107
103- cwl = CWL ( app )
104- desc = Descriptor ( app , self . repo_info )
108+ if monolithic :
109+ cwl_generators . append ( DataStagingCWL ( app ) )
105110
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 ))
108118
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" )
110124
111125 def notebook_parameters (self ):
112126
0 commit comments