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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
New Functionality
^^^^^^^^^^^^^^^^^

- To aid potential UEP instance customization, export
``GC_USER_PYTHON_VERSION`` and ``GC_USER_SDK_VERSION`` (if available from the
:ref:`user_runtime <reserved-template-variables>` structure)
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,12 @@ def cmd_start_endpoint(
user_opts,
user_runtime,
)

if py_version := user_runtime.get("python", {}).get("version"):
env.setdefault("GC_USER_PYTHON_VERSION", py_version)
if gce_version := user_runtime.get("globus_compute_sdk_version"):
env.setdefault("GC_USER_SDK_VERSION", gce_version)

exit_code += 1
_conf = yaml.safe_load(user_config)

Expand Down
27 changes: 24 additions & 3 deletions compute_endpoint/tests/unit/test_endpointmanager_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,12 @@ def command_payload(ident):
"name": "some_ep_name",
"user_opts": {"heartbeat": 10},
"amqp_creds": {},
"user_runtime": {
"python": {
"version": "3.4.2",
},
"globus_compute_sdk_version": "2.90.2",
},
},
}

Expand Down Expand Up @@ -578,7 +584,7 @@ def test_records_user_ep_as_running(successful_exec_from_mocked_root):


def test_caches_start_cmd_args_if_ep_already_running(
successful_exec_from_mocked_root, mocker
mocker, successful_exec_from_mocked_root, command_payload
):
*_, em = successful_exec_from_mocked_root
child_pid = random.randrange(1, 32768 + 1)
Expand All @@ -592,10 +598,9 @@ def test_caches_start_cmd_args_if_ep_already_running(
cached_args = em._cached_cmd_start_args.pop(child_pid)
assert cached_args is not None
mpi, args, kwargs = cached_args
exp_kw = {"name": "some_ep_name", "user_opts": {"heartbeat": 10}, "amqp_creds": {}}
assert mpi.local_user_record == _mock_localuser_rec
assert args == []
assert kwargs == exp_kw
assert kwargs == command_payload["kwargs"]


def test_writes_endpoint_uuid(epmanager_as_root):
Expand Down Expand Up @@ -1688,6 +1693,22 @@ def test_environment_default_path_set_if_not_specified(
assert "PATH" in env, "Expected PATH is always set"


def test_environment_includes_user_versions(
command_payload, successful_exec_from_mocked_root
):
mock_os, conf_dir, *_, em = successful_exec_from_mocked_root

urun = command_payload["kwargs"]["user_runtime"]
with pytest.raises(SystemExit) as pyexc:
em._event_loop()

assert pyexc.value.code == _GOOD_EC, "Q&D: verify we exec'ed, based on '+= 1'"
_, k = mock_os.execvpe.call_args
env = k["env"]
assert urun["python"]["version"] == env["GC_USER_PYTHON_VERSION"]
assert urun["globus_compute_sdk_version"] == env["GC_USER_SDK_VERSION"]


def test_warns_if_executable_not_found(
mock_log, successful_exec_from_mocked_root, randomstring
):
Expand Down
12 changes: 12 additions & 0 deletions docs/endpoints/endpoints.rst
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,18 @@ and writing a custom ``globus-compute-endpoint`` wrapper:

(The use of ``exec`` is not critical, but keeps the process tree tidy.)

The manager endpoint process exports the following two environment variables that
shim‑authors may use to fine‑tune customizations:

- ``GC_USER_PYTHON_VERSION`` - A dotted-decimal Python version (e.g., ``3.13.7``) that
specifies which version of Python was used to submit tasks to this endpoint

- ``GC_USER_SDK_VERSION`` - A dotted-decimal ``globus-compute-sdk`` version (e.g.,
``4.8.0``) that specifies what version of the `Globus Compute SDK`_ the submission
used

.. _Globus Compute SDK: https://pypi.org/project/globus-compute-sdk/


Debugging
=========
Expand Down
Loading