Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add flux module path #400

Merged
merged 1 commit into from
Mar 18, 2024
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
8 changes: 6 additions & 2 deletions src/radical/utils/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,13 @@ def get_exception_trace(msg=None):

# ------------------------------------------------------------------------------
#
def print_exception_trace(msg=None):
def print_exception_trace(msg=None, exc=None):

print_stacktrace(msg=msg, _stack=get_exception_trace())
if not exc:
print_stacktrace(msg=msg, _stack=get_exception_trace())
else:
print_stacktrace(msg=msg,
_stack=traceback.extract_tb(exc.__traceback__))


# ------------------------------------------------------------------------------
Expand Down
21 changes: 21 additions & 0 deletions src/radical/utils/flux.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# pylint: disable=cell-var-from-loop

import os
import sys
import time
import json

Expand Down Expand Up @@ -49,6 +50,16 @@ def __init__(self, uid : str,
self._watcher = None

try:
cmd = 'flux python -c "import flux; print(flux.__file__)"'
out, err, ret = sh_callout(cmd)

if ret:
raise RuntimeError('flux not found: %s' % err)

flux_path = os.path.dirname(out.strip())
mod_path = os.path.dirname(flux_path)
sys.path.append(mod_path)

self._flux = import_module('flux')
self._flux_job = import_module('flux.job')

Expand Down Expand Up @@ -297,6 +308,16 @@ def __init__(self) -> None:
self._executors = list() # TODO

try:
cmd = 'flux python -c "import flux; print(flux.__file__)"'
out, err, ret = sh_callout(cmd)

if ret:
raise RuntimeError('flux not found: %s' % err)

flux_path = os.path.dirname(out.strip())
mod_path = os.path.dirname(flux_path)
sys.path.append(mod_path)

self._flux = import_module('flux')
self._flux_job = import_module('flux.job')

Expand Down
Loading