-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for containerized sbatch/salloc
Signed-off-by: Felix Abecassis <[email protected]>
- Loading branch information
Showing
13 changed files
with
189 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. | ||
*/ | ||
|
||
#include <errno.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
|
||
#include "pyxis_alloc.h" | ||
#include "args.h" | ||
#include "config.h" | ||
|
||
struct plugin_context { | ||
struct plugin_args *args; | ||
}; | ||
|
||
static struct plugin_context context = { | ||
.args = NULL, | ||
}; | ||
|
||
int pyxis_alloc_init(spank_t sp, int ac, char **av) | ||
{ | ||
int ret; | ||
struct plugin_config config; | ||
|
||
ret = pyxis_config_parse(&config, ac, av); | ||
if (ret < 0) { | ||
slurm_error("pyxis: failed to parse configuration"); | ||
return (-1); | ||
} | ||
|
||
if (!config.sbatch_support) | ||
return (0); | ||
|
||
context.args = pyxis_args_register(sp); | ||
if (context.args == NULL) { | ||
slurm_error("pyxis: failed to register arguments"); | ||
return (-1); | ||
} | ||
|
||
return (0); | ||
} | ||
|
||
int pyxis_alloc_post_opt(spank_t sp, int ac, char **av) | ||
{ | ||
/* Calling pyxis_args_enabled() for arguments validation */ | ||
pyxis_args_enabled(); | ||
|
||
return (0); | ||
} | ||
|
||
int pyxis_alloc_exit(spank_t sp, int ac, char **av) | ||
{ | ||
pyxis_args_free(); | ||
|
||
memset(&context, 0, sizeof(context)); | ||
|
||
return (0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. | ||
*/ | ||
|
||
#ifndef PYXIS_ALLOC_H_ | ||
#define PYXIS_ALLOC_H_ | ||
|
||
#include <slurm/spank.h> | ||
|
||
int pyxis_alloc_init(spank_t sp, int ac, char **av); | ||
|
||
int pyxis_alloc_post_opt(spank_t sp, int ac, char **av); | ||
|
||
int pyxis_alloc_exit(spank_t sp, int ac, char **av); | ||
|
||
#endif /* PYXIS_ALLOC_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bats | ||
|
||
load ../common | ||
|
||
@test "sbatch ubuntu:16.04" { | ||
run_sbatch --container-image=ubuntu:16.04 <<EOF | ||
#!/bin/bash | ||
grep 'Ubuntu 16.04' /etc/os-release | ||
EOF | ||
|
||
run_sbatch <<EOF | ||
#!/bin/bash | ||
#SBATCH --container-image=ubuntu:16.04 | ||
grep 'Ubuntu 16.04' /etc/os-release | ||
EOF | ||
} | ||
|
||
@test "sbatch centos:8" { | ||
run_sbatch --container-image=centos:8 <<EOF | ||
#!/bin/bash | ||
grep 'CentOS Linux release 8.' /etc/redhat-release | ||
EOF | ||
|
||
run_sbatch <<EOF | ||
#!/bin/bash | ||
#SBATCH --container-image=centos:8 | ||
grep 'CentOS Linux release 8.' /etc/redhat-release | ||
EOF | ||
} |