Skip to content
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
113 changes: 12 additions & 101 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ anyio==4.3.0
asttokens==2.4.1
async-timeout==4.0.3; python_full_version <= "3.11.2"
autodoc-pydantic==2.2.0
aws-msk-iam-sasl-signer-python==1.0.1
babel==2.14.0
boto3==1.34.93
botocore==1.34.93
build==1.2.1
certifi==2024.2.2
cffi==1.16.0; implementation_name == "pypy" or platform_python_implementation != "PyPy"
Expand All @@ -20,7 +17,7 @@ click==8.1.7
colorama==0.4.6; sys_platform == "win32" or os_name == "nt" or platform_system == "Windows"
cryptography==42.0.5
devtools==0.12.2
diaspora-event-sdk==0.2.4
diaspora-event-sdk==0.3.2
distlib==0.3.8
docutils==0.20.1
exceptiongroup==1.2.1; python_version < "3.11"
Expand All @@ -37,7 +34,6 @@ importlib-metadata==7.1.0; python_full_version < "3.10.2"
importlib-resources==6.4.0; python_version < "3.9"
iniconfig==2.0.0
jinja2==3.1.3
jmespath==1.0.1
kafka-python==2.0.2
markupsafe==2.1.5
mmh3==4.1.0
Expand All @@ -57,7 +53,6 @@ pygments==2.17.2
pyjwt==2.8.0
pyproject-hooks==1.1.0
pytest==8.2.0
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
python-multipart==0.0.9
pytz==2024.1; python_version < "3.9"
Expand All @@ -66,7 +61,6 @@ pyzmq==26.0.2
redis==4.6.0
requests==2.31.0
ruff==0.4.2
s3transfer==0.10.1
setuptools==69.5.1
six==1.16.0
sniffio==1.3.1
Expand Down
4 changes: 0 additions & 4 deletions src/wei/core/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from wei.core.storage import (
get_experiment_directory,
get_experiments_directory,
get_workflow_runs_directory,
search_for_experiment_directory,
)
from wei.types.experiment_types import Campaign, Experiment, ExperimentDesign
Expand All @@ -23,9 +22,6 @@ def register_new_experiment(experiment_design: ExperimentDesign) -> Experiment:
new_experiment.experiment_directory = get_experiment_directory(
new_experiment.experiment_id, new_experiment.experiment_name, create=True
)
get_workflow_runs_directory(
new_experiment.experiment_id, new_experiment.experiment_name
).mkdir(parents=True, exist_ok=True)
# If a campaign is specified, check if it exists, and register the experiment
if new_experiment.campaign_id is not None:
try:
Expand Down
13 changes: 2 additions & 11 deletions src/wei/core/interfaces/rest_interface.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Handling REST execution for steps in the RPL-SDL efforts"""

import json
from pathlib import Path
from pathlib import Path, PureWindowsPath
from typing import Any, Dict, Tuple

import requests
Expand Down Expand Up @@ -66,21 +66,12 @@ def send_action(
("files", (file, open(path, "rb"))) for file, path in step.files.items()
],
)
try:
print(rest_response.headers)
print(rest_response.status_code)
print(rest_response.headers)
print(rest_response.json())
print(rest_response.headers)

except Exception as _:
pass
if "x-wei-action_response" in rest_response.headers:
response = StepResponse.from_headers(dict(rest_response.headers))
response.action_msg = PureWindowsPath(response.action_msg).as_posix()
if "run_dir" in kwargs.keys():
path = Path(
kwargs["run_dir"],
"results",
Path(step.id + "_" + Path(response.action_msg).name),
)
path.parent.mkdir(parents=True, exist_ok=True)
Expand Down
16 changes: 5 additions & 11 deletions src/wei/core/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,12 @@ def update_module(module_name: str, module: Module) -> None:

def validate_module_names(workflow: Workflow, workcell: Workcell) -> None:
"""
Validates that
- the modules in the workflow.flowdef are also in the workflow.modules
- the modules in the workflow.modules are also in the workcell.modules
- by extension, the modules in workflow.flowdef are also in the workcell.modules
Validates that the modules in the workflow.flowdef are in the workcell.modules
"""
# Validate that each step's module is also in the Workflow at the top
for step in workflow.flowdef:
if not any([step.module == module_name for module_name in workflow.modules]):
raise ValueError(f"Module {step.module} not in flow modules")

# Validate that all the modules listed in the workflow are also in the workcell
[find_step_module(workcell, module_name) for module_name in workflow.modules]
[
find_step_module(workcell, module_name)
for module_name in [step.module for step in workflow.flowdef]
]


def get_module_about(module: Module) -> Union[ModuleAbout, None]:
Expand Down
30 changes: 1 addition & 29 deletions src/wei/core/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,6 @@ def get_experiment_log_file(
)


def get_workflow_runs_directory(
experiment_id: str, experiment_name: Optional[str] = None
) -> Path:
"""Returns the workflow runs directory for the given experiment id."""
return (
get_experiment_directory(
experiment_id=experiment_id, experiment_name=experiment_name
)
/ "workflow_runs"
)


def get_workflow_run_directory(
workflow_run_id: str,
experiment_id: Optional[str] = None,
Expand All @@ -104,29 +92,13 @@ def get_workflow_run_directory(
workflow_name = wf_run.name
experiment_id = wf_run.experiment_id
return (
get_workflow_runs_directory(
get_experiment_directory(
experiment_id=experiment_id, experiment_name=experiment_name
)
/ f"{workflow_name}_id_{workflow_run_id}"
)


def get_workflow_result_directory(
workflow_run_id: str,
workflow_name: Optional[str] = None,
experiment_id: Optional[str] = None,
) -> Path:
"""Returns the directory for the given workflow id."""
return (
get_workflow_run_directory(
workflow_run_id=workflow_run_id,
workflow_name=workflow_name,
experiment_id=experiment_id,
)
/ "results"
)


def get_workflow_run_log_path(
workflow_run_id: str,
workflow_name: Optional[str] = None,
Expand Down
7 changes: 1 addition & 6 deletions src/wei/core/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from wei.core.module import validate_module_names
from wei.core.state_manager import StateManager
from wei.core.step import validate_step
from wei.core.storage import get_workflow_result_directory, get_workflow_run_directory
from wei.core.storage import get_workflow_run_directory
from wei.types import Step, Workcell, Workflow, WorkflowRun
from wei.types.workflow_types import WorkflowStatus

Expand Down Expand Up @@ -61,11 +61,6 @@ def create_run(
workflow_run_id=wf_run.run_id,
experiment_id=experiment_id,
).mkdir(parents=True, exist_ok=True)
get_workflow_result_directory(
workflow_name=wf_run.name,
workflow_run_id=wf_run.run_id,
experiment_id=experiment_id,
).mkdir(parents=True, exist_ok=True)

steps = []
for step in workflow.flowdef:
Expand Down
6 changes: 3 additions & 3 deletions src/wei/experiment_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,9 @@ def await_runs(self, run_list: List[str]) -> Dict[Any, Any]:
time.sleep(1)
return results

def list_wf_result_files(self, run_id: str) -> Any:
"""Returns a list of files from the WEI experiment result directory"""
url = f"{self.url}/runs/{run_id}/results"
def list_wf_files(self, run_id: str) -> Any:
"""Returns a list of files from the WEI experiment run directory"""
url = f"{self.url}/runs/{run_id}/files"

response = requests.get(url)
return response.json()["files"]
Expand Down
Loading