-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
- Loading branch information
Showing
2 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Test Bohrium | ||
|
||
on: | ||
push: | ||
pull_request_target: | ||
types: | ||
- "labeled" | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
environment: bohrium | ||
if: github.repository_owner == 'deepmodeling' && (github.event.label.name == 'Test Bohrium' || github.event_name == 'push') | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.12' | ||
cache: 'pip' | ||
- run: pip install .[bohrium] coverage | ||
- name: Test | ||
run: coverage run --source=./dpdispatcher -m unittest -v tests/test_run_submission_bohrium.py && coverage report | ||
env: | ||
DPDISPATCHER_TEST: bohrium | ||
BOHRIUM_EMAIL: ${{ secrets.BOHRIUM_EMAIL }} | ||
BOHRIUM_PASSWORD: ${{ secrets.BOHRIUM_PASSWORD }} | ||
BOHRIUM_PROJECT_ID: ${{ secrets.BOHRIUM_PROJECT_ID }} | ||
BOHRIUM_ACCESS_KEY: ${{ secrets.BOHRIUM_ACCESS_KEY }} | ||
- uses: codecov/codecov-action@v3 | ||
remove_label: | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
# so one can re-trigger the workflow without manually removing the label | ||
runs-on: ubuntu-latest | ||
if: github.repository_owner == 'deepmodeling' && github.event.label.name == 'Test Bohrium' | ||
steps: | ||
- uses: actions-ecosystem/action-remove-labels@v1 | ||
with: | ||
labels: Test Bohrium | ||
number: ${{ github.event.pull_request.number }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import os | ||
import sys | ||
import textwrap | ||
import unittest | ||
from pathlib import Path | ||
|
||
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) | ||
|
||
from test_run_submission import RunSubmission | ||
|
||
|
||
@unittest.skipIf( | ||
os.environ.get("DPDISPATCHER_TEST") != "bohrium", | ||
"outside the Bohrium testing environment", | ||
) | ||
class TestBohriumRun(RunSubmission, unittest.TestCase): | ||
def setUp(self): | ||
super().setUp() | ||
self.machine_dict.update( | ||
batch_type="Bohrium", | ||
context_type="Bohrium", | ||
remote_profile={ | ||
"email": os.environ["BOHRIUM_EMAIL"], | ||
"password": os.environ["BOHRIUM_PASSWORD"], | ||
"project_id": os.environ["BOHRIUM_PROJECT_ID"], | ||
"input_data": { | ||
"job_type": "indicate", | ||
"log_file": "log", | ||
"job_name": "dpdispather_test", | ||
"disk_size": 20, | ||
"scass_type": "c2_m4_cpu", | ||
"platform": "ali", | ||
"image_name": "registry.dp.tech/dptech/ubuntu:22.04-py3.10", | ||
"on_demand": 0, | ||
}, | ||
}, | ||
) | ||
|
||
@unittest.skip("Manaually skip") # comment this line to open unittest | ||
def test_async_run_submission(self): | ||
return super().test_async_run_submission() | ||
|
||
|
||
@unittest.skipIf( | ||
os.environ.get("DPDISPATCHER_TEST") != "bohrium", | ||
"outside the Bohrium testing environment", | ||
) | ||
class TestOpenAPIRun(RunSubmission, unittest.TestCase): | ||
def setUp(self): | ||
super().setUp() | ||
bohrium_config = textwrap.dedent( | ||
r"""\ | ||
[Credentials] | ||
accessKey={accesskey} | ||
""" | ||
).format(accesskey=os.environ["BOHRIUM_ACCESS_KEY"]) | ||
Path.home().joinpath(".bohrium").write_text(bohrium_config) | ||
self.machine_dict.update( | ||
batch_type="OpenAPI", | ||
context_type="OpenAPI", | ||
remote_profile={ | ||
"project_id": os.environ["BOHRIUM_PROJECT_ID"], | ||
"machine_type": "c2_m4_cpu", | ||
"platform": "ali", | ||
"image_address": "registry.dp.tech/dptech/ubuntu:22.04-py3.10", | ||
"job_name": "dpdispather_test", | ||
}, | ||
) | ||
|
||
@unittest.skip("Manaually skip") # comment this line to open unittest | ||
def test_async_run_submission(self): | ||
return super().test_async_run_submission() |