Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
ssetools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nationellt superdatorcentrum
ssetools
Commits
00a8f15b
Commit
00a8f15b
authored
1 year ago
by
Rickard Armiento
Browse files
Options
Downloads
Patches
Plain Diff
Support old reservationscripts
parent
1230fb3d
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
bin/hpc_listreservations
+78
-0
78 additions, 0 deletions
bin/hpc_listreservations
bin/hpc_usereservation
+26
-0
26 additions, 0 deletions
bin/hpc_usereservation
bin/listreservations
+1
-0
1 addition, 0 deletions
bin/listreservations
install.sh
+3
-0
3 additions, 0 deletions
install.sh
with
108 additions
and
0 deletions
bin/hpc_listreservations
0 → 100755
+
78
−
0
View file @
00a8f15b
#!/usr/bin/python3
#
# rar@nsc 2023-12-20: Updated to python3 and included in ssetools
#
# Original:
# cap 20190314 git managed in ~cap/git/reservationhelpers
from
json
import
load
from
os
import
geteuid
from
pwd
import
getpwuid
import
subprocess
import
sys
,
os
scriptdir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
username
=
getpwuid
(
geteuid
()).
pw_name
accountdataf
=
open
(
"
/etc/beowulf/active_projects.json
"
)
jsondata
=
load
(
accountdataf
)
acclist
=
[]
for
l
in
jsondata
:
if
username
in
[
x
[
u
'
login
'
]
for
x
in
l
[
u
'
accounts
'
]
]:
acclist
.
append
(
l
[
u
'
rm_name
'
])
if
"
-v
"
in
sys
.
argv
:
print
(
"
Username: %s
"
%
username
)
print
(
"
In projects: %s
"
%
str
(
acclist
))
scontrolf
=
subprocess
.
Popen
([
"
scontrol
"
,
"
-o
"
,
"
show
"
,
"
res
"
],
stderr
=
subprocess
.
STDOUT
,
stdout
=
subprocess
.
PIPE
)
reslist
=
[]
reasonlist
=
[]
for
l
in
scontrolf
.
stdout
:
ulist
=
[]
alist
=
[]
for
v
in
l
.
split
():
(
key
,
val
)
=
str
(
v
).
split
(
'
=
'
,
1
)
if
(
key
==
'
Users
'
):
ulist
=
val
.
split
(
"
,
"
)
if
(
key
==
'
Accounts
'
):
alist
=
val
.
split
(
"
,
"
)
if
(
key
==
'
ReservationName
'
):
resname
=
val
if
(
key
==
'
StartTime
'
):
starttime
=
val
if
(
key
==
'
EndTime
'
):
endtime
=
val
try
:
ulist
.
remove
(
'
(null)
'
)
except
:
pass
if
username
in
ulist
:
reslist
.
append
([
resname
,
starttime
,
endtime
,
"
(user)
"
])
for
a
in
acclist
:
if
a
in
[
x
.
lower
()
for
x
in
alist
]:
reslist
.
append
([
resname
,
starttime
,
endtime
,
"
(project:%s)
"
%
a
])
print
(
"
Reservations available to user:%s / project(s):%s
"
%
(
username
,
"
,
"
.
join
(
acclist
)))
if
(
len
(
reslist
)
>
0
):
for
r
in
reslist
:
print
(
"
%s from %s to %s %s
"
%
(
r
[
0
],
r
[
1
],
r
[
2
],
r
[
3
]))
print
(
"
devel from NOW to INF (everyone)
"
)
print
()
print
(
"
Note: set one of the above as default by running:
"
)
print
(
"
usereservation RESERVATIONNAME
"
)
print
(
"
Or without the usereservation alias:
"
)
print
(
"
source
"
+
scriptdir
+
"
/hpc_usereservation RESERVATIONNAME
"
)
scontrolf
.
wait
()
This diff is collapsed.
Click to expand it.
bin/hpc_usereservation
0 → 100644
+
26
−
0
View file @
00a8f15b
#!/bin/bash
#
# rar@nsc 2023-12-20: adjusted an included in ssetools
#
# Original version:
# initial helper by cap for course use
# 20180326 adapt to new slurm version (*_EXCLUSIVE set to empty instead of "1")
# cap 20190314 git managed in ~cap/git/reservationhelpers
if
[
"
$0
"
==
"
${
BASH_SOURCE
}
"
]
;
then
echo
"You must source this script."
exit
1
fi
if
[
"
$1
"
==
""
]
;
then
echo
"Usage: hpc_usereservation RESERVATIONNAME"
echo
" Or without the usereservation alias:"
echo
"Usage: source
${
BASH_SOURCE
[0]
}
RESERVATIONNAME"
else
echo
"Setting
$1
as active using {SALLOC,SBATCH,SLURM}_RESERVATION"
echo
export
SALLOC_RESERVATION
=
$1
export
SBATCH_RESERVATION
=
$1
export
SLURM_RESERVATION
=
$1
fi
This diff is collapsed.
Click to expand it.
bin/listreservations
0 → 120000
+
1
−
0
View file @
00a8f15b
hpc_listreservations
\ No newline at end of file
This diff is collapsed.
Click to expand it.
install.sh
+
3
−
0
View file @
00a8f15b
...
@@ -91,6 +91,9 @@ if isFile ("/software/admin/containers/images/centos7_compute_node.sif") then
...
@@ -91,6 +91,9 @@ if isFile ("/software/admin/containers/images/centos7_compute_node.sif") then
setenv("HPC_CONTAINERS_TETRALITH_EL7",capture("readlink -f /software/admin/containers/images/centos7_compute_node.sif"):gsub("
\\
n
\$
",""))
setenv("HPC_CONTAINERS_TETRALITH_EL7",capture("readlink -f /software/admin/containers/images/centos7_compute_node.sif"):gsub("
\\
n
\$
",""))
end
end
set_alias("usereservation", "source /software/sse2/generic/manual/ssetools/
${
VER
}
/bin/hpc_usereservation")
set_alias("hpc_usereservation", "source /software/sse2/generic/manual/ssetools/
${
VER
}
/bin/hpc_usereservation")
add_property("lmod","sticky")
add_property("lmod","sticky")
EOF
EOF
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment