Skip to content

Commit

Permalink
Merge branch 'feature/simple_hb' of github.com:radical-cybertools/rad…
Browse files Browse the repository at this point in the history
…ical.utils into feature/simple_hb
  • Loading branch information
andre-merzky committed Oct 15, 2024
2 parents bb3eb71 + 5e02ade commit 2e3bea3
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11' ]
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12' ]
steps:
- uses: actions/checkout@v3
with:
Expand Down
14 changes: 12 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@ For a list of open issues and known problems, see
https://github.com/radical-cybertools/radical.utils/issues/


1.83.0 Release 2024-10-15
--------------------------------------------------------------------------------

- remove an obsolete monkeypatch


1.82.0 Release 2024-10-01
--------------------------------------------------------------------------------

- ensure `version_detail` is not `None`


1.81.0 Release 2024-09-03
--------------------------------------------------------------------------------

Expand Down Expand Up @@ -916,5 +928,3 @@ Version 0.7.5 release 2014-07-22

--------------------------------------------------------------------------------

- (HEAD -> master, origin/devel, origin/HEAD, devel) devel version bump
- (HEAD -> master, origin/devel, origin/HEAD, devel) devel version bump
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.82.0
1.84.0
7 changes: 6 additions & 1 deletion src/radical/utils/atfork/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
from .atfork import monkeypatch_os_fork_functions, atfork
from .stdlib_fixer import fix_logging_module

fix_logging_module()
# Python 3.13+ has a fix for the logging locks
import sys as _sys
_py_version = float("%d.%d" % _sys.version_info[:2])
if _py_version < 3.13:
fix_logging_module()

monkeypatch_os_fork_functions()

3 changes: 2 additions & 1 deletion src/radical/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
# we know that some env vars are not worth preserving. We explicitly exclude
# those which are common to have complex syntax and need serious caution on
# shell escaping:
IGNORE_LIST = ['PS1', 'LS_COLORS', '_', 'SHLVL', 'PROMPT_COMMAND']
IGNORE_LIST = ['PS1', 'LS_COLORS', '_', 'SHLVL', 'PROMPT_COMMAND', 'LINES',
'COLUMNS']

# Identical task `pre_exec_cached` settings will result in the same environment
# settings, so we cache those environments here. We rely on a hash to ensure
Expand Down
18 changes: 8 additions & 10 deletions src/radical/utils/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
import builtins
import inspect
import os
import pkgutil

import importlib.util as imputil
import importlib

from typing import Any, Union, Optional

Expand Down Expand Up @@ -32,16 +30,16 @@ def import_module(name):
#
def find_module(name):

package = pkgutil.get_loader(name)
package = importlib.util.find_spec(name)

if not package:
return None

if '_NamespaceLoader' in str(package):
if '_NamespaceLoader' in str(package.loader):
# since Python 3.5, loaders differ between modules and namespaces
return package._path._path[0] # pylint: disable=W0212
else:
return os.path.dirname(package.get_filename())
return os.path.dirname(package.loader.get_filename())


# ------------------------------------------------------------------------------
Expand All @@ -66,8 +64,8 @@ def import_file(path):
_id_cnt += 1

uid = 'mod_%d' % _id_cnt
spec = imputil.spec_from_file_location(uid, path)
mod = imputil.module_from_spec(spec)
spec = importlib.util.spec_from_file_location(uid, path)
mod = importlib.util.module_from_spec(spec)

spec.loader.exec_module(mod)

Expand Down Expand Up @@ -119,8 +117,8 @@ def load_class(fpath: str,
raise ValueError('no source file at [%s]' % fpath)

pname = os.path.splitext(os.path.basename(fpath))[0]
spec = imputil.spec_from_file_location(pname, fpath)
plugin = imputil.module_from_spec(spec)
spec = importlib.util.spec_from_file_location(pname, fpath)
plugin = importlib.util.module_from_spec(spec)

spec.loader.exec_module(plugin)

Expand Down
4 changes: 4 additions & 0 deletions tests/integration_tests/test_flux.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
import radical.utils as ru


if not bool(ru.which('flux')):
pytest.skip('flux not installed', allow_module_level=True)


yaml = pytest.importorskip('yaml')
flux = pytest.importorskip('flux')
events = dict()
Expand Down
3 changes: 2 additions & 1 deletion tests/unittests/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def test_env_read():
env = ru.env_read(fname)

for k,v in env.items():
assert os.environ[k] == v, [k, os.environ[k], v]
if k not in ru.env.IGNORE_LIST:
assert os.environ[k] == v, [k, os.environ[k], v]

for k,v in os.environ.items():
if k not in ru.env.IGNORE_LIST:
Expand Down

0 comments on commit 2e3bea3

Please sign in to comment.