Skip to content

Commit

Permalink
fix CI failure due to name change to sophios (#306)
Browse files Browse the repository at this point in the history
Co-authored-by: Vasu Jaganath <vasu.jaganath@axleinfo.com>
  • Loading branch information
vjaganat90 and Vasu Jaganath authored Dec 26, 2024
1 parent e1dd3e6 commit 8f18c97
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 41 deletions.
44 changes: 22 additions & 22 deletions .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Checkout workflow-inference-compiler
- name: Checkout sophios
if: always()
uses: actions/checkout@v3
with:
repository: ${{ inputs.wic_owner }}/workflow-inference-compiler
repository: ${{ inputs.wic_owner }}/sophios
ref: ${{ inputs.wic_ref }}
path: workflow-inference-compiler
path: sophios

- name: Checkout biobb_adapters
if: always()
Expand Down Expand Up @@ -127,19 +127,19 @@ jobs:
# NOTE: pypy actually decreases performance for lint_and_test.yml (by a factor of ~2)
# - name: Append pypy to conda environment files
# if: runner.os != 'Windows'
# run: cd workflow-inference-compiler/install/ && echo " - pypy" >> system_deps.yml
# run: cd sophios/install/ && echo " - pypy" >> system_deps.yml

# - name: Append pypy to conda environment files
# if: runner.os == 'Windows'
# run: cd workflow-inference-compiler/install/ && echo " - pypy" >> system_deps_windows.yml
# run: cd sophios/install/ && echo " - pypy" >> system_deps_windows.yml

- name: Setup miniforge (linux, macos)
if: runner.os != 'Windows'
uses: conda-incubator/setup-miniconda@v3.0.1
with:
miniforge-variant: Miniforge-pypy3
miniforge-version: 24.7.1-0
environment-file: workflow-inference-compiler/install/system_deps.yml
environment-file: sophios/install/system_deps.yml
activate-environment: wic
channels: conda-forge
python-version: "3.9.*" # pypy is not yet compatible with 3.10 and 3.11
Expand All @@ -150,19 +150,19 @@ jobs:
with:
miniforge-variant: Miniforge-pypy3
miniforge-version: 24.7.1-0
environment-file: workflow-inference-compiler/install/system_deps_windows.yml
environment-file: sophios/install/system_deps_windows.yml
activate-environment: wic
channels: conda-forge
python-version: "3.9.*" # pypy is not yet compatible with 3.10 and 3.11

- name: ShellCheck Script Quality
if: always()
# "SC1017 (error): Literal carriage return. Run script through tr -d '\r' ."
run: shellcheck -e SC1017 $(find workflow-inference-compiler/ -name "*.sh" -and -not -path "./3/*")
run: shellcheck -e SC1017 $(find sophios/ -name "*.sh" -and -not -path "./3/*")

- name: Install Workflow Inference Compiler
if: always()
run: cd workflow-inference-compiler/ && pip install ".[all_except_runner_src]"
run: cd sophios/ && pip install ".[all_except_runner_src]"

- name: Install Molecular Modeling Workflows
if: always()
Expand All @@ -175,39 +175,39 @@ jobs:

- name: Generate Sophios Python API Workflows (*.py -> *.wic)
if: always()
run: cd workflow-inference-compiler/ && python -c 'import sophios; import sophios.plugins; sophios.plugins.blindly_execute_python_workflows()'
run: cd sophios/ && python -c 'import sophios; import sophios.plugins; sophios.plugins.blindly_execute_python_workflows()'

- name: Generate Sophios Validation Jsonschema
if: always()
run: cd workflow-inference-compiler/ && sophios --generate_schemas
run: cd sophios/ && sophios --generate_schemas

# Please read docs/validation.md#Property-Based-Testing
# This is essentially an integration test for all of the
# Sophios Python API workflows as well as the Sophios Python API itself.
- name: Validate sophios Python API Workflows (*.py -> *.wic)
if: always()
run: cd workflow-inference-compiler/ && python -c 'import sophios; import sophios.plugins; sophios.plugins.blindly_execute_python_workflows()'
run: cd sophios/ && python -c 'import sophios; import sophios.plugins; sophios.plugins.blindly_execute_python_workflows()'

- name: Build Documentation
if: always()
run: cd workflow-inference-compiler/docs && make html
run: cd sophios/docs && make html

- name: MyPy Check Type Annotations
if: always()
run: cd workflow-inference-compiler/ && mypy src/ examples/ tests/
run: cd sophios/ && mypy src/ examples/ tests/
# NOTE: Do not use `mypy .` because then mypy will check both src/ and build/ causing:
# src/workflow-inference-compiler/__init__.py: error: Duplicate module named "wic"
# (also at "./build/lib/workflow-inference-compiler/__init__.py")
# src/sophios/__init__.py: error: Duplicate module named "wic"
# (also at "./build/lib/sophios/__init__.py")

- name: PyLint Check Code Quality
if: always()
run: cd workflow-inference-compiler/ && pylint src/ examples/**/*.py tests/
run: cd sophios/ && pylint src/ examples/**/*.py tests/
# NOTE: See fail-under threshold in .pylintrc

- name: PEP8 Code Formatting
if: always()
id: autopep8
run: cd workflow-inference-compiler/ && autopep8 --exit-code --recursive --diff --max-line-length 120 examples/ src/ tests/
run: cd sophios/ && autopep8 --exit-code --recursive --diff --max-line-length 120 examples/ src/ tests/
- name: Fail if autopep8 made changes
if: steps.autopep8.outputs.exit-code == 2
run: exit 1
Expand All @@ -216,13 +216,13 @@ jobs:

- name: PyTest CWL Embedding Independence
if: always()
run: cd workflow-inference-compiler/ && pytest -k test_cwl_embedding_independence # --cov --cov-config=.coveragerc_serial
run: cd sophios/ && pytest -k test_cwl_embedding_independence # --cov --cov-config=.coveragerc_serial
# NOTE: This test MUST be run in serial! See is_isomorphic_with_timeout()
timeout-minutes: 20 # backup timeout for windows

- name: PyTest Inline Subworkflows
if: always()
run: cd workflow-inference-compiler/ && pytest -k test_inline_subworkflows # --cov --cov-config=.coveragerc_serial
run: cd sophios/ && pytest -k test_inline_subworkflows # --cov --cov-config=.coveragerc_serial
# NOTE: This test MUST be run in serial! See is_isomorphic_with_timeout()
timeout-minutes: 20 # backup timeout for windows

Expand All @@ -231,7 +231,7 @@ jobs:
# Avoid Windows and macOS due to 2X and 10X minute multipliers.
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#minute-multipliers
# Also, cannot run on Windows (natively) yet
run: cd workflow-inference-compiler/ && pytest -k test_scattering_scaling
run: cd sophios/ && pytest -k test_scattering_scaling

# NOTE: The steps below are for repository_dispatch only. For all other steps, please insert above
# this comment.
Expand Down Expand Up @@ -269,7 +269,7 @@ jobs:
# https://github.com/actions/runner/issues/834#issuecomment-907096707
# Use inputs.sender_repo to reply the original sender.
if: always()
uses: ./workflow-inference-compiler/.github/my_actions/reply_sender/ # Must start with ./
uses: ./sophios/.github/my_actions/reply_sender/ # Must start with ./
with:
github_repository: ${{ github.repository }}
event_type: ${{ inputs.event_type }}
Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/run_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ jobs:
runs-on: [self-hosted, linux]

steps:
- name: Checkout workflow-inference-compiler
- name: Checkout sophios
uses: actions/checkout@v3
with:
repository: ${{ inputs.wic_owner }}/workflow-inference-compiler
repository: ${{ inputs.wic_owner }}/sophios
ref: ${{ inputs.wic_ref }}
path: workflow-inference-compiler
path: sophios

- name: Checkout biobb_adapters
if: always()
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
# Using pypy increases performance / decreases cwltool runtime by about a minute.
- name: Append pypy to conda environment files
if: runner.os != 'Windows'
run: cd workflow-inference-compiler/install/ && echo " - pypy" >> system_deps.yml
run: cd sophios/install/ && echo " - pypy" >> system_deps.yml

- name: Remove old mamba environment
if: always()
Expand All @@ -128,7 +128,7 @@ jobs:
with:
miniforge-variant: Miniforge-pypy3
miniforge-version: 24.7.1-0
environment-file: workflow-inference-compiler/install/system_deps.yml
environment-file: sophios/install/system_deps.yml
activate-environment: wic_github_actions
channels: conda-forge
python-version: "3.9.*" # pypy is not yet compatible with 3.10 and 3.11
Expand All @@ -140,7 +140,7 @@ jobs:

- name: Install Workflow Inference Compiler
if: always()
run: cd workflow-inference-compiler/ && pip install ".[all_except_runner_src]"
run: cd sophios/ && pip install ".[all_except_runner_src]"

- name: Install Molecular Modeling Workflows
if: always()
Expand All @@ -153,48 +153,48 @@ jobs:

- name: Generate Sophios Python API Workflows (*.py -> *.wic)
if: always()
run: cd workflow-inference-compiler/ && python -c 'import sophios; import sophios.plugins; sophios.plugins.blindly_execute_python_workflows()'
run: cd sophios/ && python -c 'import sophios; import sophios.plugins; sophios.plugins.blindly_execute_python_workflows()'

- name: Generate Sophios Validation Jsonschema
if: always()
run: cd workflow-inference-compiler/ && sophios --generate_schemas
run: cd sophios/ && sophios --generate_schemas

# Please read docs/validation.md#Property-Based-Testing
# This is essentially an integration test for all of the
# WIC Python API workflows as well as the WIC Python API itself.
- name: Validate Sophios Python API Workflows (*.py -> *.wic)
if: always()
run: cd workflow-inference-compiler/ && python -c 'import sophios; import sophios.plugins; sophios.plugins.blindly_execute_python_workflows()'
run: cd sophios/ && python -c 'import sophios; import sophios.plugins; sophios.plugins.blindly_execute_python_workflows()'

- name: cwl-docker-extract (i.e. recursively docker pull)
if: always()
run: cd workflow-inference-compiler/ && pytest tests/test_examples.py -k test_cwl_docker_extract
run: cd sophios/ && pytest tests/test_examples.py -k test_cwl_docker_extract
# For self-hosted runners, make sure the docker cache is up-to-date.

- name: PyTest Run Workflows
if: always()
# NOTE: Do NOT add coverage to PYPY CI runs https://github.com/tox-dev/tox/issues/2252
run: cd workflow-inference-compiler/ && pytest tests/test_examples.py -k test_run_workflows_on_push --workers 8 --cwl_runner cwltool # --cov
run: cd sophios/ && pytest tests/test_examples.py -k test_run_workflows_on_push --workers 8 --cwl_runner cwltool # --cov

- name: PyTest Run REST Core Tests
if: always()
# NOTE: Do NOT add coverage to PYPY CI runs https://github.com/tox-dev/tox/issues/2252
run: cd workflow-inference-compiler/ && pytest tests/test_rest_core.py -k test_rest_core --cwl_runner cwltool
run: cd sophios/ && pytest tests/test_rest_core.py -k test_rest_core --cwl_runner cwltool

- name: PyTest Run REST WFB Tests
if: always()
# NOTE: Do NOT add coverage to PYPY CI runs https://github.com/tox-dev/tox/issues/2252
run: cd workflow-inference-compiler/ && pytest tests/test_rest_wfb.py -k test_rest_wfb --cwl_runner cwltool
run: cd sophios/ && pytest tests/test_rest_wfb.py -k test_rest_wfb --cwl_runner cwltool

- name: PyTest Run ICT to CLT conversion Tests
if: always()
# NOTE: Do NOT add coverage to PYPY CI runs https://github.com/tox-dev/tox/issues/2252
run: cd workflow-inference-compiler/ && pytest tests/test_ict_to_clt_conversion.py -k test_ict_to_clt
run: cd sophios/ && pytest tests/test_ict_to_clt_conversion.py -k test_ict_to_clt

- name: PyTest Run update wfb payload Tests
if: always()
# NOTE: Do NOT add coverage to PYPY CI runs https://github.com/tox-dev/tox/issues/2252
run: cd workflow-inference-compiler/ && pytest tests/test_fix_payload.py -k test_fix
run: cd sophios/ && pytest tests/test_fix_payload.py -k test_fix

# NOTE: The steps below are for repository_dispatch only. For all other steps, please insert above
# this comment.
Expand Down Expand Up @@ -232,7 +232,7 @@ jobs:
# https://github.com/actions/runner/issues/834#issuecomment-907096707
# Use inputs.sender_repo to reply the original sender.
if: always()
uses: ./workflow-inference-compiler/.github/my_actions/reply_sender/ # Must start with ./
uses: ./sophios/.github/my_actions/reply_sender/ # Must start with ./
with:
github_repository: ${{ github.repository }}
event_type: ${{ inputs.event_type }}
Expand Down
21 changes: 18 additions & 3 deletions src/sophios/input_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,21 @@ def write_config_to_disk(config: Json, config_file: Path) -> None:
json.dump(config, f, indent=4, sort_keys=True)


def check_sister_directories(parent_dir: Path, target_names: list[str]) -> bool:
"""Checks if sister directories with given names exist."""

parent_path = Path(parent_dir)
if not parent_path.is_dir():
return False

for target_name in target_names:
sister_path = parent_path.parent / target_name
if not sister_path.is_dir():
return False

return True


def get_config(config_file: Path, default_config_file: Path) -> Json:
"""Returns the config json object from config_file with absolute paths
Expand All @@ -152,10 +167,10 @@ def get_config(config_file: Path, default_config_file: Path) -> Json:
Json: The config json object with absolute filepaths
"""
global_config: Json = {}
proj_root_dir = 'workflow-inference-compiler'
ci_sister_dirs = ['mm-workflows', 'image-workflows']
if not config_file.exists():
# check if sophios is run from 'project root' dir
if str(Path.cwd()).endswith(proj_root_dir):
# check if sophios is run from 'ci environment' dir
if check_sister_directories(Path.cwd(), ci_sister_dirs):
if config_file == default_config_file:
global_config = get_default_config()
# write the default config object to the 'global_config.json' file in user's ~/wic directory
Expand Down
3 changes: 3 additions & 0 deletions tests/test_rest_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ async def receive() -> Json:
res: Json = asyncio.run(restapi.compile_wf(req)) # call to rest api
return res


@pytest.mark.skip_pypi_ci
@pytest.mark.fast
def test_rest_core_single_node() -> None:
Expand All @@ -148,6 +149,7 @@ def test_rest_core_single_node() -> None:
retval = run_cwl_local(workflow_name, 'cwltool', 'docker', False)
assert retval == 0


@pytest.mark.skip_pypi_ci
def test_rest_core_single_node_bbbc() -> None:
"""A simple single node sophios/restapi test"""
Expand All @@ -163,6 +165,7 @@ def test_rest_core_single_node_bbbc() -> None:
retval = run_cwl_local(workflow_name, 'cwltool', 'docker', False)
assert retval == 0


@pytest.mark.skip_pypi_ci
def test_rest_core_bbbc_download_wfb() -> None:
"""A simple multi node (inline cwl) sophios/restapi test"""
Expand Down

0 comments on commit 8f18c97

Please sign in to comment.