Skip to content

Commit

Permalink
Merge pull request #64 from romeokienzler/main
Browse files Browse the repository at this point in the history
create cwl task for containerless operator
  • Loading branch information
romeokienzler authored Jun 20, 2024
2 parents a16e729 + 7113a45 commit 6da7a3e
Showing 1 changed file with 14 additions and 2 deletions.
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

0 comments on commit 6da7a3e

Please sign in to comment.