Skip to content

Commit

Permalink
Merge pull request #37 from jameshcorbett/dws-python-install
Browse files Browse the repository at this point in the history
build: add DWS python files to build
  • Loading branch information
mergify[bot] authored Feb 1, 2023
2 parents a3c86f8 + b52eeb7 commit 247cefd
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 9 deletions.
12 changes: 8 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ AC_SUBST(fluxrc1dir)
AS_VAR_SET(fluxrc3dir, $sysconfdir/flux/rc3.d)
AC_SUBST(fluxrc3dir)

AS_VAR_SET(fluxcoral2pydir, $pyexecdir/fluxcoral2)
AC_SUBST(fluxcoral2pydir)
AS_VAR_SET(fluxk8spydir, $pyexecdir/flux_k8s)
AC_SUBST(fluxk8spydir)

# Target of PYTHONPATH set by flux(1) cmddriver, so flux(1)
# doesn't inadvertently insert system python paths (or any
# other python path for that matter) first in PYTHONPATH.
#
AS_VAR_SET(fluxcoral2pylinkdir, $fluxlibdir/python$PYTHON_VERSION)
AC_SUBST(fluxcoral2pylinkdir)
AS_VAR_SET(fluxk8spylinkdir, $fluxlibdir/python$PYTHON_VERSION)
AC_SUBST(fluxk8spylinkdir)

##
# Macros to avoid repetition in Makefiles.am's
Expand All @@ -147,6 +147,10 @@ AC_CONFIG_FILES([Makefile
src/job-manager/plugins/Makefile
src/shell/Makefile
src/shell/plugins/Makefile
src/cmd/Makefile
src/modules/Makefile
src/python/Makefile
src/python/flux_k8s/Makefile
t/Makefile])
AC_OUTPUT

Expand Down
5 changes: 4 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.NOTPARALLEL:

SUBDIRS = job-manager \
shell
shell \
cmd \
modules \
python

check-local: all
2 changes: 2 additions & 0 deletions src/cmd/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist_fluxcmd_SCRIPTS = \
flux-dws2jgf.py
2 changes: 1 addition & 1 deletion src/job-manager/plugins/dws-jobtap.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ static int run_cb (flux_plugin_t *p,
flux_future_destroy (fetch_R_future);
flux_log_error (h,
"dws-jobtap: "
"Error creating future to send R to dws.py");
"Error creating future to send R to coral2_dws.py");
dws_prolog_finish (h, p, id, 0, "", prolog_active);
return -1;
}
Expand Down
2 changes: 2 additions & 0 deletions src/modules/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist_bin_SCRIPTS = \
coral2_dws.py
5 changes: 4 additions & 1 deletion src/modules/dws.py → src/modules/coral2_dws.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,10 @@ def main():
parser.add_argument("--watch-interval", type=int, default=5)
parser.add_argument("--verbose", "-v", action="count", default=0)
args = parser.parse_args()
try:
jobid = id_parse(os.environ["FLUX_JOB_ID"])
except KeyError as keyerr:
raise RuntimeError("this script is meant to be run as a Flux job") from keyerr
log_level = logging.WARNING
if args.verbose > 1:
log_level = logging.INFO
Expand Down Expand Up @@ -428,7 +432,6 @@ def main():
# process starting and the `dws` service being registered. Once
# https://github.com/flux-framework/flux-core/issues/3821 is
# implemented/closed, this can be replaced with that solution.
jobid = id_parse(os.environ["FLUX_JOB_ID"])
Future(fh.job_raise(jobid, "exception", 7, "dws watchers setup")).get()

fh.reactor_run()
Expand Down
5 changes: 5 additions & 0 deletions src/python/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.NOTPARALLEL:

SUBDIRS = flux_k8s

check-local: all
24 changes: 24 additions & 0 deletions src/python/flux_k8s/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
nobase_fluxk8spy_PYTHON = \
__init__.py \
crd.py \
directivebreakdown.py \
watch.py


clean-local:
-rm -f *.pyc */*.pyc *.pyo */*.pyo
-rm -rf __pycache__ */__pycache__

install-data-hook:
$(AM_V_at)echo Linking flux_k8s py in non-standard location... && \
$(INSTALL) -d -m 0755 "$(DESTDIR)$(fluxk8spylinkdir)" && \
target=$(fluxk8spydir) && \
f=$${target##*/} && \
cd "$(DESTDIR)$(fluxk8spylinkdir)" && \
rm -f $$f && \
$(LN_S) $$target .

uninstall-local:
$(AM_V_at)target=$(fluxk8spydir) && f=$${target##*/} && \
echo "Removing $(fluxk8spylinkdir)/$$f" && \
rm -rf $(fluxk8spylinkdir)/$$f
2 changes: 1 addition & 1 deletion t/t1002-dws-workflow-obj.t
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test_under_flux ${FLUX_SIZE} job
flux setattr log-stderr-level 1

PLUGINPATH=${FLUX_BUILD_DIR}/src/job-manager/plugins/.libs
DWS_MODULE_PATH=${FLUX_SOURCE_DIR}/src/modules/dws.py
DWS_MODULE_PATH=${FLUX_SOURCE_DIR}/src/modules/coral2_dws.py
RPC=${FLUX_BUILD_DIR}/t/util/rpc
CREATE_DEP_NAME="dws-create"

Expand Down
2 changes: 1 addition & 1 deletion t/t1003-dws-nnf-watch.t
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test_under_flux ${FLUX_SIZE} job
flux setattr log-stderr-level 1

DATA_DIR=${SHARNESS_TEST_SRCDIR}/data/nnf-watch/
DWS_MODULE_PATH=${FLUX_SOURCE_DIR}/src/modules/dws.py
DWS_MODULE_PATH=${FLUX_SOURCE_DIR}/src/modules/coral2_dws.py
RPC=${FLUX_BUILD_DIR}/t/util/rpc

check_dmesg_for_pattern() {
Expand Down

0 comments on commit 247cefd

Please sign in to comment.