Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
tud-zih-energy
Slurm
Commits
22b995c0
Commit
22b995c0
authored
4 years ago
by
Marcin Stolarek
Committed by
Ben Roberts
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Docs - Add example cli_filter.lua script to etc/
Example of a cli_filter.lua script Bug 9405
parent
c4c8d457
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
etc/cli_filter.lua.example
+96
-0
96 additions, 0 deletions
etc/cli_filter.lua.example
slurm.spec
+2
-0
2 additions, 0 deletions
slurm.spec
with
98 additions
and
0 deletions
etc/cli_filter.lua.example
0 → 100644
+
96
−
0
View file @
22b995c0
--[[
--This is an example of cli_filter.lua script for Slurm
--More information about Slurm cli_filter:
-- https://slurm.schedmd.com/cli_filter_plugins.html
--To find names of options, take a look at:
-- src/common/slurm_opt.c
--]]
function _find_in_str(str, arg)
if str ~= nil then
local place = string.find(str,arg)
if place == 1
then
return true
else
return false
end
else
return false
end
end
function slurm_cli_pre_submit(options, pack_offset)
--[[
-- Checks done in cli_filter can be worked around by users switching to different
-- SLURM_CONF or using their own build of tools where call to cli_filter was removed.
--
-- If strict policy enforcement is a requirement than job_submit plugin should be used.
--]]
if options["type"] == "srun"
then
if options["uid"] == "0" --[[or options["uid"] == SpecialUser]]--
then
slurm.log_info("srun allowed for uid: %s", options["uid"])
else
if options["pty"] == "set"
then
slurm.log_error("Use of srun with --pty is forbidden for uid: %s", options["uid"])
return slurm.ERROR
end
end
end
if options["type"] == "sbatch" and options["wrap"] ~= nil
then
slurm.log_error("--wrap option is forbidden");
return slurm.ERROR
end
local script_location = {}
script_location[1] = "/opt/supported_scripts"
script_location[2] = "/opt/supported_scripts2"
local allowed = false
for idx,location in ipairs(script_location)
do
if _find_in_str(options.argv[1], location)
then
allowed = true
break
end
end
if allowed == false
then
slurm.log_error("You have to use scripts from one of:")
for idx, location in ipairs(script_location)
do
slurm.log_error("- %s", location)
end
return slurm.ERROR
end
return slurm.SUCCESS
end
function slurm_cli_setup_defaults(options, early_pass)
--[[
-- Make --hint=nomultithread a default behavior
-- if user specifies other --hint=XX option then
-- it will override the setting done here
--]]--
options['hint'] = 'nomultithread'
return slurm.SUCCESS
end
function slurm_cli_post_submit(offset, job_id, step_id)
slurm.log_info("Submitted: %d.%d component: %d", job_id, step_id, offset);
return slurm.SUCCESS
end
This diff is collapsed.
Click to expand it.
slurm.spec
+
2
−
0
View file @
22b995c0
...
@@ -412,6 +412,7 @@ install -D -m644 etc/slurmrestd.service %{buildroot}/%{_unitdir}/slurmrestd.ser
...
@@ -412,6 +412,7 @@ install -D -m644 etc/slurmrestd.service %{buildroot}/%{_unitdir}/slurmrestd.ser
install -D -m644 etc/cgroup.conf.example %{buildroot}/%{_sysconfdir}/cgroup.conf.example
install -D -m644 etc/cgroup.conf.example %{buildroot}/%{_sysconfdir}/cgroup.conf.example
install -D -m644 etc/slurm.conf.example %{buildroot}/%{_sysconfdir}/slurm.conf.example
install -D -m644 etc/slurm.conf.example %{buildroot}/%{_sysconfdir}/slurm.conf.example
install -D -m600 etc/slurmdbd.conf.example %{buildroot}/%{_sysconfdir}/slurmdbd.conf.example
install -D -m600 etc/slurmdbd.conf.example %{buildroot}/%{_sysconfdir}/slurmdbd.conf.example
install -D -m644 etc/cli_filter.lua.example %{buildroot}/%{_sysconfdir}/cli_filter.lua.example
install -D -m755 contribs/sjstat %{buildroot}/%{_bindir}/sjstat
install -D -m755 contribs/sjstat %{buildroot}/%{_bindir}/sjstat
# Delete unpackaged files:
# Delete unpackaged files:
...
@@ -540,6 +541,7 @@ rm -rf %{buildroot}
...
@@ -540,6 +541,7 @@ rm -rf %{buildroot}
%config %{_sysconfdir}/cgroup.conf.example
%config %{_sysconfdir}/cgroup.conf.example
%config %{_sysconfdir}/slurm.conf.example
%config %{_sysconfdir}/slurm.conf.example
%config %{_sysconfdir}/slurmdbd.conf.example
%config %{_sysconfdir}/slurmdbd.conf.example
%config %{_sysconfdir}/cli_filter.lua.example
#############################################################################
#############################################################################
%files devel
%files devel
...
...
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