Skip to content

Commit c63202f

Browse files
committed
Github Action for GlobusComputeExecutor (#3619)
* Support for testing GlobusComputeExecutor in a github action * Adding shared_fs and staging_required tags to tests * Adding GlobusComputeExecutor test config
1 parent adbe5a4 commit c63202f

File tree

8 files changed

+137
-9
lines changed

8 files changed

+137
-9
lines changed

.github/workflows/gce_test.yaml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: GlobusComputeExecutor tests
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
9+
jobs:
10+
main-test-suite:
11+
strategy:
12+
matrix:
13+
python-version: ["3.11"]
14+
runs-on: ubuntu-20.04
15+
timeout-minutes: 60
16+
17+
steps:
18+
- uses: actions/checkout@master
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Collect Job Information
26+
id: job-info
27+
run: |
28+
echo "Python Version: ${{ matrix.python-version }}" >> ci_job_info.txt
29+
echo "CI Triggering Event: ${{ github.event_name }}" >> ci_job_info.txt
30+
echo "Triggering Git Ref: ${{ github.ref }}" >> ci_job_info.txt
31+
echo "Triggering Git SHA: ${{ github.sha }}" >> ci_job_info.txt
32+
echo "Workflow Run: ${{ github.run_number }}" >> ci_job_info.txt
33+
echo "Workflow Attempt: ${{ github.run_attempt }}" >> ci_job_info.txt
34+
as_ascii="$(echo "${{ github.ref_name }}" | perl -pe "s/[^A-z0-9-]+/-/g; s/^-+|-+\$//g; s/--+/-/g;")"
35+
echo "as-ascii=$as_ascii" >> $GITHUB_OUTPUT
36+
37+
- name: Non-requirements based install
38+
run: |
39+
# libpython3.5: make workqueue binary installer happy
40+
# mpich: required by radical executor
41+
sudo apt-get update -q
42+
sudo apt-get install -qy libpython3.5 mpich
43+
44+
- name: setup virtual env
45+
run: |
46+
make virtualenv
47+
source .venv/bin/activate
48+
49+
- name: make deps clean_coverage
50+
run: |
51+
source .venv/bin/activate
52+
make deps
53+
make clean_coverage
54+
55+
# Temporary fix, until changes make it into compute releases
56+
git clone -b configure_tasks_working_dir https://github.com/globus/globus-compute.git
57+
pip3 install globus-compute/compute_sdk globus-compute/compute_endpoint
58+
59+
- name: start globus_compute_endpoint
60+
env:
61+
GLOBUS_COMPUTE_CLIENT_ID: ${{ secrets.GLOBUS_COMPUTE_CLIENT_ID }}
62+
GLOBUS_COMPUTE_CLIENT_SECRET: ${{ secrets.GLOBUS_COMPUTE_SECRET_KEY }}
63+
run: |
64+
source /home/runner/work/parsl/parsl/.venv/bin/activate
65+
globus-compute-endpoint configure default
66+
which globus-compute-endpoint
67+
python3 -c "import globus_compute_sdk; print(globus_compute_sdk.__version__)"
68+
python3 -c "import globus_compute_endpoint; print(globus_compute_endpoint.__version__)"
69+
cat << EOF > /home/runner/.globus_compute/default/config.yaml
70+
engine:
71+
type: ThreadPoolEngine
72+
max_workers: 4
73+
working_dir: /home/runner/.globus_compute/default/tasks_working_dir
74+
EOF
75+
cat /home/runner/.globus_compute/default/config.yaml
76+
mkdir ~/.globus_compute/default/tasks_working_dir
77+
globus-compute-endpoint start default
78+
globus-compute-endpoint list
79+
- name: make test
80+
env:
81+
GLOBUS_COMPUTE_CLIENT_ID: ${{ secrets.GLOBUS_COMPUTE_CLIENT_ID }}
82+
GLOBUS_COMPUTE_CLIENT_SECRET: ${{ secrets.GLOBUS_COMPUTE_SECRET_KEY }}
83+
run: |
84+
source .venv/bin/activate
85+
export GLOBUS_COMPUTE_ENDPOINT=$(globus-compute-endpoint list | grep default | cut -c 3-38)
86+
echo "GLOBUS_COMPUTE_ENDPOINT = $GLOBUS_COMPUTE_ENDPOINT"
87+
88+
# temporary; until test-matrixification
89+
export PARSL_TEST_PRESERVE_NUM_RUNS=7
90+
91+
make gce_test
92+
ln -s .pytest/parsltest-current test_runinfo
93+
94+
- name: Archive runinfo logs
95+
if: ${{ always() }}
96+
uses: actions/upload-artifact@v4
97+
with:
98+
name: runinfo-${{ matrix.python-version }}-${{ steps.job-info.outputs.as-ascii }}-${{ github.sha }}
99+
path: |
100+
runinfo/
101+
.pytest/
102+
ci_job_info.txt
103+
compression-level: 9

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ clean_coverage:
5151
mypy: ## run mypy checks
5252
MYPYPATH=$(CWD)/mypy-stubs mypy parsl/
5353

54+
.PHONY: gce_test
55+
gce_test: ## Run tests with GlobusComputeExecutor
56+
pytest -v -k "not shared_fs and not issue_3620 and not staging_required" --config parsl/tests/configs/globus_compute.py parsl/tests/ --random-order --durations 10
57+
5458
.PHONY: local_thread_test
5559
local_thread_test: ## run all tests with local_thread config
5660
pytest parsl/tests/ -k "not cleannet" --config parsl/tests/configs/local_threads.py --random-order --durations 10

docs/reference.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ Executors
7777
parsl.executors.taskvine.TaskVineExecutor
7878
parsl.executors.FluxExecutor
7979
parsl.executors.radical.RadicalPilotExecutor
80+
parsl.executors.globus_compute.GlobusComputeExecutor
8081

8182
Manager Selectors
8283
=================

parsl/executors/globus_compute.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,13 @@
22
from concurrent.futures import Future
33
from typing import Any, Callable, Dict, Optional, Union
44

5-
import typeguard
6-
75
from parsl.errors import OptionalModuleMissing
86
from parsl.executors.base import ParslExecutor
97
from parsl.utils import RepresentationMixin
108

119
UUID_LIKE_T = Union[uuid.UUID, str]
1210

1311

14-
1512
class GlobusComputeExecutor(ParslExecutor, RepresentationMixin):
1613
""" GlobusComputeExecutor enables remote execution on Globus Compute endpoints
1714
@@ -25,15 +22,14 @@ def __init__(
2522
self,
2623
endpoint_id: Optional[UUID_LIKE_T] = None,
2724
task_group_id: Optional[UUID_LIKE_T] = None,
28-
resource_specification: Optional[dict[str, Any]] = None,
29-
user_endpoint_config: Optional[dict[str, Any]] = None,
25+
resource_specification: Optional[Dict[str, Any]] = None,
26+
user_endpoint_config: Optional[Dict[str, Any]] = None,
3027
label: str = "GlobusComputeExecutor",
3128
batch_size: int = 128,
3229
amqp_port: Optional[int] = None,
3330
**kwargs,
34-
):
31+
):
3532
"""
36-
3733
Parameters
3834
----------
3935
@@ -141,5 +137,3 @@ def shutdown(self, wait=True, *, cancel_futures=False):
141137
Tasks cannot be cancelled once they are registered.
142138
"""
143139
return self._executor.shutdown()
144-
145-
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import os
2+
3+
from parsl.config import Config
4+
from parsl.executors import GlobusComputeExecutor
5+
6+
7+
def fresh_config():
8+
9+
endpoint_id = os.environ["GLOBUS_COMPUTE_ENDPOINT"]
10+
11+
return Config(
12+
executors=[
13+
GlobusComputeExecutor(
14+
label="globus_compute",
15+
endpoint_id=endpoint_id
16+
)
17+
]
18+
)

parsl/tests/conftest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ def pytest_configure(config):
163163
'markers',
164164
'shared_fs: Marks tests that require a shared_fs between the workers are the test client'
165165
)
166+
config.addinivalue_line(
167+
'markers',
168+
'issue_3620: Marks tests that do not work correctly on GlobusComputeExecutor (ref: issue 3620)'
169+
)
166170

167171

168172
@pytest.fixture(autouse=True, scope='session')

parsl/tests/test_error_handling/test_resource_spec.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import pytest
2+
13
import parsl
24
from parsl.app.app import python_app
35
from parsl.executors import WorkQueueExecutor
@@ -11,6 +13,7 @@ def double(x, parsl_resource_specification={}):
1113
return x * 2
1214

1315

16+
@pytest.mark.issue_3620
1417
def test_resource(n=2):
1518
executors = parsl.dfk().executors
1619
executor = None

test-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ types-mock
1010
types-python-dateutil
1111
types-requests
1212
mpi4py
13+
globus-compute-sdk>=2.27.1
1314

1415
# sqlalchemy is needed for typechecking, so it's here
1516
# as well as at runtime for optional monitoring execution

0 commit comments

Comments
 (0)