diff --git a/Makefile b/Makefile index 674c936db3e745b2c83e3a9d54e0af9519f0eba6..f0d780446fbca8bafd9d3a0366e48b122f1d5322 100644 --- a/Makefile +++ b/Makefile @@ -31,9 +31,11 @@ include VERSION -INSTALL_FILES=VERSION prologue.user epilogue.user mjf.init \ - mjf-torque.sh mjf-torque.csh mjf-get-total-cpu.torque \ - mjf-htcondor.sh mjf-htcondor.csh mjf-job-wrapper htcondor-jobfeatures +INSTALL_FILES=VERSION mjf.init \ + prologue.user epilogue.user \ + mjf.sh.torque mjf.csh.torque mjf-get-total-cpu.torque \ + mjf.sh.htcondor mjf.csh.htcondor mjf-get-total-cpu.htcondor \ + mjf-job-wrapper make-jobfeatures.htcondor TGZ_FILES=$(INSTALL_FILES) Makefile mjf-torque.spec mjf-htcondor.spec README @@ -51,9 +53,9 @@ install: $(INSTALL_FILES) $(RPM_BUILD_ROOT)/etc/rc.d/init.d/mjf torque-install: $(INSTALL_FILES) install - cp mjf-torque.sh \ + cp mjf.sh.torque \ $(RPM_BUILD_ROOT)/etc/profile.d/mjf.sh - cp mjf-torque.csh \ + cp mjf.csh.torque \ $(RPM_BUILD_ROOT)/etc/profile.d/mjf.csh mkdir -p $(RPM_BUILD_ROOT)/var/lib/torque/mom_priv mkdir -p $(RPM_BUILD_ROOT)/usr/sbin @@ -73,12 +75,16 @@ torque-rpm: mjf-scripts.tgz --buildroot $(shell pwd)/RPMTMP/BUILDROOT mjf-torque.spec htcondor-install: $(INSTALL_FILES) install - cp mjf-htcondor.sh \ + cp mjf.sh.htcondor \ $(RPM_BUILD_ROOT)/etc/profile.d/mjf.sh - cp mjf-htcondor.csh \ + cp mjf.csh.htcondor \ $(RPM_BUILD_ROOT)/etc/profile.d/mjf.csh - cp mjf-job-wrapper htcondor-jobfeatures \ + cp mjf-job-wrapper \ $(RPM_BUILD_ROOT)/usr/sbin + cp make-jobfeatures.htcondor \ + $(RPM_BUILD_ROOT)/usr/sbin/make-jobfeatures + cp mjf-get-total-cpu.htcondor \ + $(RPM_BUILD_ROOT)/usr/sbin/mjf-get-total-cpu htcondor-rpm: mjf-scripts.tgz rm -Rf RPMTMP diff --git a/htcondor-jobfeatures b/make-jobfeatures.htcondor similarity index 97% rename from htcondor-jobfeatures rename to make-jobfeatures.htcondor index c7a930a933b3d3676771152c171c50c2f2b40097..0ee77dfa0001b2fbed6479676368086b7f2da61e 100755 --- a/htcondor-jobfeatures +++ b/make-jobfeatures.htcondor @@ -1,6 +1,6 @@ #!/usr/bin/python # -# htcondor-jobfeatures script for Machine/Job Features on HTCondor +# make-jobfeatures script for Machine/Job Features on HTCondor # # Andrew McNab, University of Manchester. # Copyright (c) 2016. All rights reserved. @@ -68,13 +68,13 @@ os.umask(0022) try: fromMachineAd = open(os.environ['_CONDOR_MACHINE_AD'],'r').read() except: - sys.stderr.write('Could not read $_CONDOR_MACHINE_AD file - exiting htcondor-jobfeatures\n') + sys.stderr.write('Could not read $_CONDOR_MACHINE_AD file - exiting make-jobfeatures\n') sys.exit(10) try: fromJobAd = open(os.environ['_CONDOR_JOB_AD'],'r').read() except: - sys.stderr.write('Could not read $_CONDOR_JOB_AD file - exiting htcondor-jobfeatures\n') + sys.stderr.write('Could not read $_CONDOR_JOB_AD file - exiting make-jobfeatures\n') sys.exit(10) try: @@ -227,3 +227,7 @@ if hs06_job: # We got it from somewhere open(jobfeaturesDir + '/hs06_job', 'w').write('%.2f' % hs06_job) +# We output $JOBFEATURES in case the calling script needs it +print jobfeaturesDir + + \ No newline at end of file diff --git a/mjf-get-total-cpu.htcondor b/mjf-get-total-cpu.htcondor new file mode 100755 index 0000000000000000000000000000000000000000..d3168e760f45ccd6f8e66b13492bd5c5fff219e4 --- /dev/null +++ b/mjf-get-total-cpu.htcondor @@ -0,0 +1,11 @@ +#!/bin/sh +# +# Output the number of processors assigned by HTCondor on this host. +# +# This script must be installed as /usr/sbin/mjf-get-total-cpu to be +# picked up by the generic /etc/rc.d/init.d/mjf ! +# +# Andrew.McNab@cern.ch +# + +condor_config_val NUM_CPUS diff --git a/mjf-job-wrapper b/mjf-job-wrapper index 6bcf81e3956cb5a340a413dcefe970fd7dac2eca..da08389a96431a95bccac5fb64a3eb4406b44707 100755 --- a/mjf-job-wrapper +++ b/mjf-job-wrapper @@ -43,14 +43,18 @@ # the htcondor-jobfeatures Python script to create $JOBFEATURES # -# This script outputs the value of $JOBFEATURES. (We could just -# run the script without recording the value of $JOBFEATURES.) -jobfeatures=`/usr/sbin/htcondor-jobfeatures` +# This script outputs the value of $JOBFEATURES. This variable +# should be coming from /etc/profile/mjf.[c]sh too! +export JOBFEATURES=`/usr/sbin/make-jobfeatures` + +if [ -d /etc/machinefeatures ] ; then + export MACHINEFEATURES=/etc/machinefeatures +fi $* # We tidy these up. They are in /tmp by default so we could just # leave them to be removed by the system instead. -if [ -d "$jobfeatures" ] ; then - rm -Rf "$jobfeatures" +if [ -d "$JOBFEATURES" ] ; then + rm -Rf "$JOBFEATURES" fi diff --git a/mjf-htcondor.csh b/mjf.csh.htcondor similarity index 100% rename from mjf-htcondor.csh rename to mjf.csh.htcondor diff --git a/mjf-torque.csh b/mjf.csh.torque similarity index 100% rename from mjf-torque.csh rename to mjf.csh.torque diff --git a/mjf-htcondor.sh b/mjf.sh.htcondor similarity index 100% rename from mjf-htcondor.sh rename to mjf.sh.htcondor diff --git a/mjf-torque.sh b/mjf.sh.torque similarity index 100% rename from mjf-torque.sh rename to mjf.sh.torque