Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
machinejobfeatures
mjf-scripts
Commits
9b2ccbcb
Commit
9b2ccbcb
authored
Mar 01, 2016
by
Andrew McNab
Browse files
Add mjf-get-total-cpu
parent
193274f8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
9b2ccbcb
...
...
@@ -31,9 +31,9 @@
include
VERSION
INSTALL_FILES
=
VERSION prologue.user epilogue.user mjf.init mjf.sh mjf.csh
INSTALL_FILES
=
VERSION prologue.user epilogue.user mjf.init mjf.sh mjf.csh
mjf-get-total-cpu.torque
TGZ_FILES
=
$(INSTALL_FILES)
Makefile mjf-
scripts
.spec
TGZ_FILES
=
$(INSTALL_FILES)
Makefile mjf-
torque.spec mjf-htcondor
.spec
GNUTAR
?=
tar
mjf-scripts.tgz
:
$(TGZ_FILES)
...
...
@@ -43,21 +43,38 @@ mjf-scripts.tgz: $(TGZ_FILES)
rm
-R
TEMPDIR
install
:
$(INSTALL_FILES)
mkdir
-p
$(RPM_BUILD_ROOT)
/var/lib/torque/mom_priv
\
$(RPM_BUILD_ROOT)
/etc/rc.d/init.d
\
$(RPM_BUILD_ROOT)
/etc/profile.d
cp
prologue.user epilogue.user
\
$(RPM_BUILD_ROOT)
/var/lib/torque/mom_priv
mkdir
-p
$(RPM_BUILD_ROOT)
/etc/rc.d/init.d
\
$(RPM_BUILD_ROOT)
/etc/profile.d
cp
mjf.init
\
$(RPM_BUILD_ROOT)
/etc/rc.d/init.d/mjf
$(RPM_BUILD_ROOT)
/etc/rc.d/init.d/mjf
cp
mjf.sh mjf.csh
\
$(RPM_BUILD_ROOT)
/etc/profile.d
$(RPM_BUILD_ROOT)
/etc/profile.d
install-torque
:
$(INSTALL_FILES) install
mkdir
-p
$(RPM_BUILD_ROOT)
/var/lib/torque/mom_priv
\
mkdir
-p
$(RPM_BUILD_ROOT)
/usr/bin
\
cp
prologue.user epilogue.user
\
$(RPM_BUILD_ROOT)
/var/lib/torque/mom_priv
cp
mjf-get-total-cpu.torque
\
$(RPM_BUILD_ROOT)/usr/bin/mjf-get-total-cpu
torque-rpm
:
mjf-scripts.tgz
rm
-Rf
RPMTMP
mkdir
-p
RPMTMP/SOURCES RPMTMP/SPECS RPMTMP/BUILD
\
RPMTMP/SRPMS RPMTMP/RPMS/noarch RPMTMP/BUILDROOT
cp
-f
mjf-scripts.tgz RPMTMP/SOURCES
export
MJF_VERSION
=
$(VERSION)
;
rpmbuild
-ba
\
--define
"_topdir
$(
shell
pwd
)
/RPMTMP"
\
--buildroot
$(
shell
pwd
)
/RPMTMP/BUILDROOT mjf-torque.spec
install-htcondor
:
$(INSTALL_FILES) install
rpm
:
mjf-scripts.tgz
htcondor-
rpm
:
mjf-scripts.tgz
rm
-Rf
RPMTMP
mkdir
-p
RPMTMP/SOURCES RPMTMP/SPECS RPMTMP/BUILD
\
RPMTMP/SRPMS RPMTMP/RPMS/noarch RPMTMP/BUILDROOT
cp
-f
mjf-scripts.tgz RPMTMP/SOURCES
export
MJF_VERSION
=
$(VERSION)
;
rpmbuild
-ba
\
--define
"_topdir
$(
shell
pwd
)
/RPMTMP"
\
--buildroot
$(
shell
pwd
)
/RPMTMP/BUILDROOT mjf-scripts.spec
--buildroot
$(
shell
pwd
)
/RPMTMP/BUILDROOT mjf-htcondor.spec
VERSION
View file @
9b2ccbcb
VERSION=00.0
3
VERSION=00.0
4
mjf-get-total-cpu.torque
0 → 100755
View file @
9b2ccbcb
#!/bin/sh
#
# Output the number of processors assigned by Torque/PBS to this node.
# Requires that the pbsnodes command is installed and that you have
# permission to run it.
#
# This script must be installed as /usr/bin/mjf-get-total-cpu to be
# picked up by the generic /etc/rc.d/init.d/mjf !
#
# Andrew.McNab@cern.ch
#
total_cpu
=
`
pbsnodes
\`
hostname
\`
|
grep
'^ * np = '
|
head
-1
|
sed
's/^ * np = //'
`
if
[
"
$total_cpu
"
!=
""
]
;
then
echo
$total_cpu
exit
0
fi
total_cpu
=
`
pbsnodes
\`
hostname
-s
\`
|
grep
'^ * np = '
|
head
-1
|
sed
's/^ * np = //'
`
if
[
"
$total_cpu
"
!=
""
]
;
then
echo
$total_cpu
exit
0
fi
exit
1
mjf-htcondor.spec
0 → 100644
View file @
9b2ccbcb
Name: mjf-htcondor
Version: %(echo ${MJF_VERSION:-0.0})
Release: 1
BuildArch: noarch
Summary: Machine/Job Features for HTCondor
License: BSD
Group: System Environment/Daemons
Source: mjf-scripts.tgz
Vendor: GridPP
Packager: Andrew McNab <Andrew.McNab@cern.ch>
%description
Currently this only creates $MACHINEFEATURES!
%prep
%setup -n mjf-scripts
%build
%install
make install-htcondor
%post
chkconfig mjf on
service mjf start
%preun
if [ "$1" = "0" ] ; then
# if uninstallation rather than upgrade then stop
chkconfig mjf off
service mjf stop
fi
%files
/etc/rc.d/init.d/*
/etc/profile.d/*
mjf-
scripts
.spec
→
mjf-
torque
.spec
View file @
9b2ccbcb
Name: mjf-
scripts
Name: mjf-
torque
Version: %(echo ${MJF_VERSION:-0.0})
Release: 1
BuildArch: noarch
...
...
@@ -12,21 +12,6 @@ Packager: Andrew McNab <Andrew.McNab@cern.ch>
%description
MJF implementations following HSF-TN-2016-02
%package -n mjf-torque
Group: System Environment/Daemons
Summary: Machine/Job Features for Torque/PBS
%description -n mjf-torque
MJF following HSF-TN-2016-02 for Torque/PBS
%package -n mjf-htcondor
Group: System Environment/Daemons
Summary: Machine/Job Features for HTCondor
%description -n mjf-htcondor
MJF following HSF-TN-2016-02 for HTCondor
Currently this only creates $MACHINEFEATURES!
%prep
%setup -n mjf-scripts
...
...
@@ -34,35 +19,21 @@ Currently this only creates $MACHINEFEATURES!
%build
%install
make install
make install
-torque
%post
-n mjf-torque
%post
chkconfig mjf on
service mjf start
%preun
-n mjf-torque
%preun
if [ "$1" = "0" ] ; then
# if uninstallation rather than upgrade then stop
chkconfig mjf off
service mjf stop
fi
%files
-n mjf-torque
%files
/var/lib/torque/mom_priv
/etc/rc.d/init.d/*
/etc/profile.d/*
%post -n mjf-htcondor
chkconfig mjf on
service mjf start
%preun -n mjf-htcondor
if [ "$1" = "0" ] ; then
# if uninstallation rather than upgrade then stop
chkconfig mjf off
service mjf stop
fi
%files -n mjf-htcondor
/etc/rc.d/init.d/*
/etc/profile.d/*
/usr/bin/*
mjf.init
View file @
9b2ccbcb
...
...
@@ -38,8 +38,15 @@ start() {
mkdir
-p
/etc/machinefeatures.tmp
if
[
"
$total_cpu
"
==
""
]
;
then
# If not explicitly configured then calculate from hardware
total_cpu
=
`
grep
'^processor[[:space:]]*:'
/proc/cpuinfo |
wc
--lines
`
# If not explicitly configured then try to get it from the batch system
if
[
-x
/usr/bin/get-total-cpu
]
;
then
$total_cpu
=
`
/usr/bin/get-total-cpu
`
fi
# If still not explicitly configured then it get from the OS
if
[
"
$total_cpu
"
==
""
]
;
then
total_cpu
=
`
grep
'^processor[[:space:]]*:'
/proc/cpuinfo |
wc
--lines
`
fi
fi
echo
-n
"
$total_cpu
"
>
/etc/machinefeatures.tmp/total_cpu
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment