Skip to content

Commit 1786cb8

Browse files
committed
Make the old approach to creating an application package deprecated, but
still available with an optional argument.
1 parent cb31ecc commit 1786cb8

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

unity_app_generator/__main__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def build_cwl(args):
7979

8080
app_gen = UnityApplicationGenerator(state_dir)
8181

82-
app_gen.create_cwl(cwl_output_path=args.cwl_output_path, docker_url=args.image_url)
82+
app_gen.create_cwl(cwl_output_path=args.cwl_output_path, docker_url=args.image_url, monolithic=args.monolithic)
8383

8484
def push_app_registry(args):
8585
state_dir = check_state_directory(state_directory_path(args))
@@ -152,6 +152,9 @@ def main():
152152
parser_build_cwl.add_argument("-u", "--image_url",
153153
help="Docker image tag or remote registry URL to be included in the generated CWL files if not using the build_docker and/or push_docker subcommands")
154154

155+
parser_build_cwl.add_argument("--monolithic", action="store_true",
156+
help="Use the deprecated 'monolithic' approach to generating CWL where stage in and out are bundled inside the application")
157+
155158
parser_build_cwl.set_defaults(func=build_cwl)
156159

157160
# push_app_registry

unity_app_generator/generator.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
from .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, BundledDataStagingCWL, Descriptor
1011

1112
from 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"""
6162
cwlVersion: v1.0
6263
6364
class: Workflow
@@ -66,14 +67,15 @@ def _generate_dockstore_cwl(self, cwl_output_path):
6667
6768
steps:
6869
step:
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
@@ -100,13 +102,20 @@ def create_cwl(self, cwl_output_path=None, docker_url=None):
100102

101103
logger.info("Parameters:\n" + app.parameter_summary())
102104

103-
cwl = CWL(app)
105+
if monolithic:
106+
cwl = BundledDataStagingCWL(app)
107+
else:
108+
cwl = ProcessCWL(app)
109+
104110
desc = Descriptor(app, self.repo_info)
105111

106-
files = cwl.generate_all(cwl_output_path, docker_url)
112+
files = cwl.generate_all(cwl_output_path, dockerurl=docker_url)
107113
files.append(desc.generate_descriptor(cwl_output_path, docker_url))
108114

109-
self._generate_dockstore_cwl(cwl_output_path)
115+
if monolithic:
116+
self._generate_dockstore_cwl(cwl_output_path, "workflow.cwl")
117+
else:
118+
self._generate_dockstore_cwl(cwl_output_path, "process.cwl")
110119

111120
def notebook_parameters(self):
112121

0 commit comments

Comments
 (0)