Skip to content

Commit

Permalink
Merge pull request #305 from NERSC/fix-wrapper
Browse files Browse the repository at this point in the history
Fix logging and update for Slurm
  • Loading branch information
scanon committed Aug 29, 2021
2 parents e17f545 + 99b3b7e commit f42c6d1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sudo: true
dist: trusty
dist: bionic
language: python
python:
- "2.7"
Expand All @@ -9,9 +9,9 @@ compiler:
# command to install dependencies
before_install:
- sudo chmod 755 /var/log
- sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ precise universe multiverse"
- sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ bionic universe multiverse"
- sudo apt-get update -qq
- sudo apt-get install -qq libjson-c2 libjson-c-dev munge libmunge2 libmunge-dev libcurl4-openssl-dev autoconf automake libtool curl make valgrind xfsprogs squashfs-tools libcap-dev
- sudo apt-get install -qq libjson-c-dev munge libmunge2 libmunge-dev libcurl4-openssl-dev autoconf automake libtool curl make valgrind xfsprogs squashfs-tools libcap-dev
- sudo modprobe squashfs
- sudo modprobe xfs
- cat /proc/filesystems
Expand All @@ -28,8 +28,9 @@ before_script:
- cp imagegw/test.json.example test.json
- mkdir /tmp/imagegw /tmp/systema /tmp/systemb
- rm imagegw/test/sha256sum
- find /tmp/
script:
- echo "Disabling autoclear for Travis and Kernel 5.4"
- sed -i 's/useAutoclear = 1;/useAutoclear = 0;/' ./src/shifter_core.c
- export PROC_COUNT=$(cat /proc/cpuinfo | egrep '^processor' | wc -l)
- ./autogen.sh
- ./configure --prefix=/usr --sysconfdir=/etc/shifter --disable-staticsshd
Expand Down
2 changes: 1 addition & 1 deletion extra/CI/integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ done

echo "setting up munge"
if [[ -e /usr/sbin/create-munge-key ]]; then
sudo /usr/sbin/create-munge-key
sudo /usr/sbin/create-munge-key -f
fi
sudo service munge start

Expand Down
2 changes: 1 addition & 1 deletion shifter.spec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

Summary: NERSC Shifter -- Containers for HPC
Name: shifter
Version: 18.03.5
Version: 18.03.6
Release: %{shifter_release}
License: BSD (LBNL-modified)
Group: System Environment/Base
Expand Down
14 changes: 7 additions & 7 deletions wlm_integration/slurm/shifterSpank.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ int forkAndExecvLogToSlurm(const char *appname, char **args) {
if (stdoutStream) {
ssize_t nBytes = getline(&lineBuffer, &lineBuffer_sz, stdoutStream);
if (nBytes > 0) {
_log(LOG_ERROR, "%s stdout: %s", appname, lineBuffer);
_log(LOG_DEBUG, "%s stdout: %s", appname, lineBuffer);
} else {
fclose(stdoutStream);
stdoutStream = NULL;
Expand All @@ -348,7 +348,7 @@ int forkAndExecvLogToSlurm(const char *appname, char **args) {
}

/* wait on the child */
_log(LOG_ERROR, "waiting on %s\n", appname);
_log(LOG_INFO, "waiting on %s\n", appname);
waitpid(pid, &status, 0);
if (WIFEXITED(status)) {
rc = WEXITSTATUS(status);
Expand Down Expand Up @@ -928,7 +928,7 @@ int shifterSpank_job_prolog(shifterSpank_config *ssconfig) {
set_type = 1;
}

_log(LOG_ERROR, "about to lookup image in prolog env");
_log(LOG_INFO, "about to lookup image in prolog env");
ptr = getenv("SPANK_SHIFTER_IMAGE");
if (ptr != NULL) {
char *tmp = imageDesc_filterString(ptr, set_type ? ssconfig->imageType : NULL);
Expand Down Expand Up @@ -1144,7 +1144,7 @@ int shifterSpank_job_prolog(shifterSpank_config *ssconfig) {
strncpy_StringArray(ssconfig->image, strlen(ssconfig->image), &setupRootArgs_sv, &setupRootArgs, &n_setupRootArgs, 10);

for (setupRootArgs_sv = setupRootArgs; setupRootArgs_sv && *setupRootArgs_sv; setupRootArgs_sv++) {
_log(LOG_ERROR, "setupRoot arg %d: %s", (int)(setupRootArgs_sv - setupRootArgs), *setupRootArgs_sv);
_log(LOG_INFO, "setupRoot arg %d: %s", (int)(setupRootArgs_sv - setupRootArgs), *setupRootArgs_sv);
}

/* setup memory cgroup if necessary */
Expand All @@ -1168,7 +1168,7 @@ int shifterSpank_job_prolog(shifterSpank_config *ssconfig) {

int status = forkAndExecvLogToSlurm("setupRoot", setupRootArgs);

_log(LOG_ERROR, "after setupRoot, exit code: %d", status);
_log(LOG_INFO, "after setupRoot, exit code: %d", status);


if (status == 0) {
Expand All @@ -1183,7 +1183,7 @@ int shifterSpank_job_prolog(shifterSpank_config *ssconfig) {
}

pid = findSshd();
_log(LOG_DEBUG, "shifter_prolog: sshd on pid %d\n", pid);
_log(LOG_INFO, "shifter_prolog: sshd on pid %d\n", pid);

_prolog_exit_unclean:
if (setupRootArgs != NULL) {
Expand Down Expand Up @@ -1289,7 +1289,7 @@ int shifterSpank_job_epilog(shifterSpank_config *ssconfig) {
rc = SLURM_ERROR;
}

_log(LOG_DEBUG, "shifter_epilog: done with unsetupRoot");
_log(LOG_INFO, "shifter_epilog: done with unsetupRoot");

_epilog_exit_unclean:
return rc;
Expand Down
9 changes: 6 additions & 3 deletions wlm_integration/slurm/wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,18 +331,21 @@ int setup_libslurm() {
return ERROR;
}

extern int slurm_stepd_connect(const char *dir, const char *node, uint32_t job, uint32_t step, uint16_t *protocol);
extern int slurm_stepd_connect(const char *dir, const char *node, slurm_step_id_t *step, uint16_t *protocol);
extern int slurm_stepd_add_extern_pid(uint32_t, uint16_t, pid_t);
extern hostlist_t slurm_hostlist_create_dims(const char *hostlist, int dims);
extern char * slurm_hostlist_deranged_string_malloc(hostlist_t hl);

int wrap_spank_stepd_connect(shifterSpank_config *ssconfig, char *dir,
char *hostname, uint32_t jobid, uint32_t stepid, uint16_t *protocol)
{
int (*stepd_connect)(const char *, const char *, uint32_t, uint32_t, uint16_t*);
int (*stepd_connect)(const char *, const char *, slurm_step_id_t *, uint16_t*);
if (setup_libslurm() != SUCCESS) return -1;
stepd_connect = slurm_stepd_connect;
return (*stepd_connect)(dir, hostname, jobid, stepid, protocol);
slurm_step_id_t step = { .job_id = jobid,
.step_het_comp = NO_VAL,
.step_id = stepid,};
return (*stepd_connect)(dir, hostname, &step, protocol);
}

int wrap_spank_stepd_add_extern_pid(shifterSpank_config *ssconfig,
Expand Down

0 comments on commit f42c6d1

Please sign in to comment.