Skip to content
Snippets Groups Projects
Commit 0e2633b4 authored by Moe Jette's avatar Moe Jette
Browse files

Correct free function for batch submit RPC data.

slurmd now accept batch submit RPC - It just dumps the data and returns
SLURM_SUCCESS for right now.
parent d8b74622
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,7 @@ LDADD = $(top_srcdir)/src/common/libcommon.la \ ...@@ -31,6 +31,7 @@ LDADD = $(top_srcdir)/src/common/libcommon.la \
slurmd_LDADD = $(process_lib) $(io_lib) $(LDADD) $(interconnect_lib) slurmd_LDADD = $(process_lib) $(io_lib) $(LDADD) $(interconnect_lib)
common_sources = slurmd.c \ common_sources = slurmd.c \
batch_mgr.c \
get_mach_stat.c \ get_mach_stat.c \
read_proc.c \ read_proc.c \
task_mgr.c \ task_mgr.c \
......
/*****************************************************************************\
* batch_mgr.c - functions for batch job management (spawn and monitor job)
*****************************************************************************
* Copyright (C) 2002 The Regents of the University of California.
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
* Written by Kevin Tew <tew1@llnl.gov> et. al.
* UCRL-CODE-2002-040.
*
* This file is part of SLURM, a resource management program.
* For details, see <http://www.llnl.gov/linux/slurm/>.
*
* SLURM is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along
* with SLURM; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
\*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#define EXTREME_DEBUG 1
#include <src/common/log.h>
#include <src/common/slurm_errno.h>
#include <src/common/slurm_protocol_defs.h>
#include <src/slurmd/batch_mgr.h>
#include <src/slurmd/slurmd.h>
void dump_batch_desc (batch_job_launch_msg_t *batch_job_launch_msg);
/* launch_batch_job - establish the environment and launch a batch job script */
int
launch_batch_job (batch_job_launch_msg_t *batch_job_launch_msg)
{
#if EXTREME_DEBUG
dump_batch_desc (batch_job_launch_msg);
#endif
return SLURM_SUCCESS;
}
void
dump_batch_desc (batch_job_launch_msg_t *batch_job_launch_msg)
{
int i;
debug3 ("Launching batch job: job_id=%u, user_id=%u, nodes=%s",
batch_job_launch_msg->job_id, batch_job_launch_msg->user_id,
batch_job_launch_msg->nodes);
debug3 (" work_dir=%s, stdin=%s",
batch_job_launch_msg->work_dir, batch_job_launch_msg->stdin);
debug3 (" stdout=%s, stderr=%s",
batch_job_launch_msg->stdout, batch_job_launch_msg->stderr);
debug3 (" script=%s", batch_job_launch_msg->script);
for (i=0; i<batch_job_launch_msg->argc; i++) {
debug3 (" argv[%d]=%s", i, batch_job_launch_msg->argv[i]);
}
for (i=0; i<batch_job_launch_msg->env_size; i++) {
debug3 (" environment[%d]=%s", i, batch_job_launch_msg->environment[i]);
}
}
/*****************************************************************************\
* batch_mgr.h - definitions for batch job management (spawn and monitor job)
*****************************************************************************
* Copyright (C) 2002 The Regents of the University of California.
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
* Written by Moe Jette <jette1@llnl.gov> et. al.
* UCRL-CODE-2002-040.
*
* This file is part of SLURM, a resource management program.
* For details, see <http://www.llnl.gov/linux/slurm/>.
*
* SLURM is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along
* with SLURM; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
\*****************************************************************************/
#ifndef _BATCH_MGR_H
#define _BATCH_MGR_H
#if HAVE_CONFIG_H
# include <config.h>
#endif /* HAVE_CONFIG_H */
extern int launch_batch_job (batch_job_launch_msg_t *batch_job_launch_msg);
#endif
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <src/common/util_signals.h> #include <src/common/util_signals.h>
#include <src/common/log.h> #include <src/common/log.h>
#include <src/slurmd/batch_mgr.h>
#include <src/slurmd/get_mach_stat.h> #include <src/slurmd/get_mach_stat.h>
#include <src/slurmd/slurmd.h> #include <src/slurmd/slurmd.h>
#include <src/slurmd/task_mgr.h> #include <src/slurmd/task_mgr.h>
...@@ -87,6 +88,7 @@ static void *slurmd_msg_engine(void *args); ...@@ -87,6 +88,7 @@ static void *slurmd_msg_engine(void *args);
inline static int send_node_registration_status_msg(); inline static int send_node_registration_status_msg();
inline static void slurm_rpc_kill_tasks(slurm_msg_t * msg); inline static void slurm_rpc_kill_tasks(slurm_msg_t * msg);
inline static void slurm_rpc_launch_batch_job(slurm_msg_t * msg);
inline static void slurm_rpc_launch_tasks(slurm_msg_t * msg); inline static void slurm_rpc_launch_tasks(slurm_msg_t * msg);
inline static void slurm_rpc_ping(slurm_msg_t * msg); inline static void slurm_rpc_ping(slurm_msg_t * msg);
inline static void slurm_rpc_reattach_tasks_streams(slurm_msg_t * msg); inline static void slurm_rpc_reattach_tasks_streams(slurm_msg_t * msg);
...@@ -406,6 +408,10 @@ void slurmd_req(slurm_msg_t * msg) ...@@ -406,6 +408,10 @@ void slurmd_req(slurm_msg_t * msg)
{ {
switch (msg->msg_type) { switch (msg->msg_type) {
case REQUEST_BATCH_JOB_LAUNCH:
slurm_rpc_launch_batch_job(msg);
slurm_free_job_launch_msg(msg->data);
break;
case REQUEST_LAUNCH_TASKS: case REQUEST_LAUNCH_TASKS:
slurm_rpc_launch_tasks(msg); slurm_rpc_launch_tasks(msg);
slurm_free_launch_tasks_request_msg(msg->data); slurm_free_launch_tasks_request_msg(msg->data);
...@@ -639,6 +645,30 @@ int slurmd_shutdown() ...@@ -639,6 +645,30 @@ int slurmd_shutdown()
return SLURM_PROTOCOL_SUCCESS; return SLURM_PROTOCOL_SUCCESS;
} }
void slurm_rpc_launch_batch_job(slurm_msg_t * msg)
{
/* init */
int error_code = SLURM_SUCCESS;
clock_t start_time;
batch_job_launch_msg_t *batch_job_launch_msg = ( batch_job_launch_msg_t * ) msg->data ;
start_time = clock();
/* do RPC call */
error_code = launch_batch_job(batch_job_launch_msg);
/* return result */
if (error_code) {
error("slurmd_req: error %d, time=%ld",
error_code, (long) (clock() - start_time));
slurm_send_rc_msg(msg, error_code);
} else {
info("slurmd_req: completed successfully, time=%ld",
(long) (clock() - start_time));
slurm_send_rc_msg(msg, SLURM_SUCCESS);
}
}
void slurm_rpc_slurmd_template(slurm_msg_t * msg) void slurm_rpc_slurmd_template(slurm_msg_t * msg)
{ {
/* init */ /* init */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment