Skip to content

Remove bundling of stage in/out from unity-app-generator by default #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
app_pack_generator>=0.4.3
unity-sds-client==0.2.0
app_pack_generator>=1.0.0
unity-sds-client>=0.2.0
5 changes: 4 additions & 1 deletion unity_app_generator/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def build_cwl(args):

app_gen = UnityApplicationGenerator(state_dir)

app_gen.create_cwl(cwl_output_path=args.cwl_output_path, docker_url=args.image_url)
app_gen.create_cwl(cwl_output_path=args.cwl_output_path, docker_url=args.image_url, monolithic=args.monolithic)

def push_app_registry(args):
state_dir = check_state_directory(state_directory_path(args))
Expand Down Expand Up @@ -152,6 +152,9 @@ def main():
parser_build_cwl.add_argument("-u", "--image_url",
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")

parser_build_cwl.add_argument("--monolithic", action="store_true",
help="Use the deprecated 'monolithic' approach to generating CWL where stage in and out are bundled inside the application")

parser_build_cwl.set_defaults(func=build_cwl)

# push_app_registry
Expand Down
34 changes: 24 additions & 10 deletions unity_app_generator/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

from .state import ApplicationState

from app_pack_generator import GitManager, DockerUtil, ApplicationNotebook, CWL, Descriptor
from app_pack_generator import GitManager, DockerUtil, ApplicationNotebook
from app_pack_generator import ProcessCWL, DataStagingCWL, Descriptor

from unity_sds_client.services.application_service import DockstoreAppCatalog

Expand Down Expand Up @@ -55,9 +56,9 @@ def push_to_docker_registry(self, docker_registry, image_tag=None):
# Push to remote repository
self.app_state.docker_url = self.docker_util.push_image(docker_registry, self.app_state.docker_image_tag)

def _generate_dockstore_cwl(self, cwl_output_path):
def _generate_dockstore_cwl(self, cwl_output_path, target_cwl_filename):

template = """
template = f"""
cwlVersion: v1.0

class: Workflow
Expand All @@ -66,14 +67,15 @@ def _generate_dockstore_cwl(self, cwl_output_path):

steps:
step:
run: workflow.cwl
run: {target_cwl_filename}
"""

# Hard code file name because it is a hard coded re
dockstore_cwl_filename = os.path.join(cwl_output_path, "Dockstore.cwl")
with open(dockstore_cwl_filename, "w") as cwl_file:
cwl_file.write(template.lstrip())

def create_cwl(self, cwl_output_path=None, docker_url=None):
def create_cwl(self, cwl_output_path=None, docker_url=None, monolithic=False):

# Fall through using docker_image_tag if docker_url does not exist because no push has occurred
# Or if docker_url is supplied as an argument use that
Expand All @@ -99,14 +101,26 @@ def create_cwl(self, cwl_output_path=None, docker_url=None):
app = ApplicationNotebook(notebook_filename)

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

# Create CWL files depending on the mode of production
cwl_generators = [ ProcessCWL(app) ]

cwl = CWL(app)
desc = Descriptor(app, self.repo_info)
if monolithic:
cwl_generators.append( DataStagingCWL(app) )

files = cwl.generate_all(cwl_output_path, docker_url)
files.append(desc.generate_descriptor(cwl_output_path, docker_url))
files_created = []
for cwl_gen in cwl_generators:
files_created += cwl_gen.generate_all(cwl_output_path, dockerurl=docker_url)

# Add the JSON descriptor file
desc = Descriptor(app, self.repo_info)
files_created.append(desc.generate_descriptor(cwl_output_path, docker_url))

self._generate_dockstore_cwl(cwl_output_path)
# Add Dockstore.cwl, point it to the appropriate entry point
if monolithic:
self._generate_dockstore_cwl(cwl_output_path, "workflow.cwl")
else:
self._generate_dockstore_cwl(cwl_output_path, "process.cwl")

def notebook_parameters(self):

Expand Down
2 changes: 1 addition & 1 deletion unity_app_generator/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__="0.3.2"
__version__="1.0.0"