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

Investigation of parsl for workflow orchestration #1

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
32 changes: 32 additions & 0 deletions kbmod_workflow/kbmod_wf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import os
import parsl
from datetime import datetime
from parsl import python_app, File
import parsl.executors

from klone_config import klone_config


@python_app(executors=['local_dev_testing', 'small_cpu'])
def uri_to_ic(inputs=[], outputs=[], logger=None):
logger.info('Starting uri_to_ic')
return 42


with parsl.load(klone_config()):
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")

logging_file_path = os.path.join(os.getcwd(), f'kbmod_wf_{timestamp}.log')
parsl_logger = parsl.set_file_logger(filename=logging_file_path)
uri_list = File(os.path.join(os.getcwd(), 'uri_list.txt'))

uri_to_ic_future = uri_to_ic(
inputs=[uri_list],
outputs=[File(os.path.join(os.getcwd(), 'ic.ecsv'))],
logger=parsl_logger
)

print(uri_to_ic_future.result())


parsl.clear()
33 changes: 33 additions & 0 deletions kbmod_workflow/klone_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from parsl import Config
from parsl.executors import HighThroughputExecutor, ThreadPoolExecutor
from parsl.launchers import SrunLauncher
from parsl.providers import SlurmProvider

walltimes = {
"compute-bigmem": "01:00:00", # change this to be appropriate
}

def klone_config():
return Config(
executors=[
HighThroughputExecutor(
label="small_cpu",
provider=SlurmProvider(
partition="compute-bigmem",
account="astro",
min_blocks=0,
max_blocks=4,
init_blocks=1,
parallelism=1,
nodes_per_block=1,
cores_per_node=1, # perhaps should be 8???
mem_per_node=64, # In GB
exclusive=False,
walltime=walltimes["compute-bigmem"],
),
),
ThreadPoolExecutor(
label="local_dev_testing",
)
]
)
1 change: 1 addition & 0 deletions kbmod_workflow/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
parsl==2024.07.01