Skip to content

Commit

Permalink
Fixed flux import. (#677)
Browse files Browse the repository at this point in the history
* Fixed flux import.

* Fixed style issue.
  • Loading branch information
Paul-Ferrell authored Aug 14, 2023
1 parent 1e258c7 commit 44745cb
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion lib/pavilion/schedulers/plugins/flux.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@


# Just import flux once
HAS_FLUX = False
try:
import flux
import flux.hostlist
Expand All @@ -30,7 +31,25 @@
from flux.job import JobspecV1
HAS_FLUX = True
except ImportError:
HAS_FLUX = False
_MINOR_VERSION = sys.version_info.minor
_FLUX_PATH = None
for i in range(_MINOR_VERSION, 5, -1):
_FLUX_PATH = "/usr/lib64/flux/python3.{}".format(_MINOR_VERSION)
if os.path.exists(_FLUX_PATH):
break

if _FLUX_PATH is not None:
sys.path.append(_FLUX_PATH)
try:
import flux
import flux.hostlist
import flux.job
import flux.resource
from flux.job import JobspecV1
HAS_FLUX = True
except ImportError:
pass


flux_states = [
"DEPEND",
Expand Down

0 comments on commit 44745cb

Please sign in to comment.