Skip to content
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

create cwl task for containerless operator #64

Merged
merged 2 commits into from
Jun 20, 2024
Merged
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
16 changes: 14 additions & 2 deletions src/c3/create_containerless_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
import logging
import subprocess
import re
from c3.create_operator import create_cwl_component
from c3.pythonscript import Pythonscript


def create_containerless_operator(
file_path,
version,
):

logging.debug(f'Called create_containerless_operator with {file_path}')
if version is None:
version = 'latest'

logging.debug(f'Called create_containerless_operator {version} with {file_path}')

filename, file_extension = os.path.splitext(file_path)

Expand All @@ -26,14 +32,20 @@ def create_containerless_operator(
all_pip_packages_found += (f' {pip_packages}')
logging.info(f'all PIP packages found: {all_pip_packages_found}')


subprocess.run(';'.join(['rm -Rf claimedenv','python -m venv claimedenv',
'source ./claimedenv/bin/activate',
f'pip install {all_pip_packages_found.strip()}',
'pip list',
f'zip -r {filename}.zip {file_path} claimedenv',
'rm -Rf claimedenv']), shell=True)

script_data = Pythonscript(file_path)
inputs = script_data.get_inputs()
outputs = script_data.get_outputs()

create_cwl_component(filename, "containerless", version, file_path, inputs, outputs)




def main():
Expand Down