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

Job update API now functioning.

parent 3984e12d
No related branches found
No related tags found
No related merge requests found
...@@ -13,29 +13,12 @@ ...@@ -13,29 +13,12 @@
/* /*
* slurm_allocate - allocate nodes for a job with supplied contraints. * slurm_allocate - allocate nodes for a job with supplied contraints.
* input: spec - specification of the job's constraints
* job_id - place into which a job_id can be stored
* output: job_id - the job's id
* node_list - list of allocated nodes
* returns 0 if no error, EINVAL if the request is invalid,
* EAGAIN if the request can not be satisfied at present
* NOTE: required specifications include: User=<uid>
* optional specifications include: Contiguous=<YES|NO>
* Distribution=<BLOCK|CYCLE> Features=<features> Groups=<groups>
* JobId=<id> JobName=<name> Key=<credential> MinProcs=<count>
* MinRealMemory=<MB> MinTmpDisk=<MB> Partition=<part_name>
* Priority=<integer> ProcsPerTask=<count> ReqNodes=<node_list>
* Shared=<YES|NO> TimeLimit=<minutes> TotalNodes=<count>
* TotalProcs=<count>
* NOTE: the calling function must free the allocated storage at node_list[0] * NOTE: the calling function must free the allocated storage at node_list[0]
*/ */
extern int slurm_allocate_resources (job_desc_msg_t * job_desc_msg , resource_allocation_response_msg_t ** job_alloc_resp_msg, int immediate ) ; extern int slurm_allocate_resources (job_desc_msg_t * job_desc_msg , resource_allocation_response_msg_t ** job_alloc_resp_msg, int immediate ) ;
/* /*
* slurm_cancel - cancel the specified job * slurm_cancel - cancel the specified job
* input: job_id - the job_id to be cancelled
* output: returns 0 if no error, EINVAL if the request is invalid,
* EAGAIN if the request can not be satisfied at present
*/ */
extern int slurm_cancel_job (uint32_t job_id); extern int slurm_cancel_job (uint32_t job_id);
...@@ -170,8 +153,7 @@ extern int parse_node_name (char *node_name, char **format, int *start_inx, ...@@ -170,8 +153,7 @@ extern int parse_node_name (char *node_name, char **format, int *start_inx,
*/ */
extern int slurm_reconfigure (); extern int slurm_reconfigure ();
/* /* update a job, node, or partition's configuration, root access only */
* slurm_update_node - updates the node state extern int slurm_update_job ( job_desc_msg_t * job_msg ) ;
*/ extern int slurm_update_node ( update_node_msg_t * node_msg ) ;
int slurm_update_node ( update_node_msg_t * node_msg ) ; extern int slurm_update_partition ( update_part_msg_t * part_msg ) ;
int slurm_update_partition ( update_part_msg_t * desc_msg ) ;
/* /****************************************************************************\
* update_config.c - request that slurmctld update its configuration * update_config.c - request that slurmctld update its configuration
* *****************************************************************************
* author: moe jette, jette@llnl.gov * 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> and Kevin Tew <tew1@llnl.gov.
* 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 #ifdef HAVE_CONFIG_H
# include <config.h> # include <config.h>
...@@ -14,55 +34,33 @@ ...@@ -14,55 +34,33 @@
#include <src/api/slurm.h> #include <src/api/slurm.h>
#include <src/common/slurm_protocol_api.h> #include <src/common/slurm_protocol_api.h>
int slurm_update (void * data, slurm_msg_type_t msg_type);
/* /* slurm_update_job - update a job's configuration per request */
* update_config - _ request that slurmctld update its configuration per request int
* input: a line containing configuration information per the configuration file format slurm_update_job ( job_desc_msg_t * job_msg )
* output: returns 0 on success, errno otherwise
*/
int slurm_update_node ( update_node_msg_t * node_msg )
{ {
int msg_size; return slurm_update ((void *) job_msg, REQUEST_UPDATE_JOB);
int rc ; }
slurm_fd sockfd ;
slurm_msg_t request_msg ;
slurm_msg_t response_msg ;
return_code_msg_t * rc_msg ;
/* init message connection for message communication with controller */
if ( ( sockfd = slurm_open_controller_conn ( ) ) == SLURM_SOCKET_ERROR )
return SLURM_SOCKET_ERROR ;
/* send request message */
request_msg . msg_type = REQUEST_UPDATE_NODE ;
request_msg . data = node_msg ;
if ( ( rc = slurm_send_controller_msg ( sockfd , & request_msg ) ) == SLURM_SOCKET_ERROR )
return SLURM_SOCKET_ERROR ;
/* receive message */
if ( ( msg_size = slurm_receive_msg ( sockfd , & response_msg ) ) == SLURM_SOCKET_ERROR )
return SLURM_SOCKET_ERROR ;
/* shutdown message connection */
if ( ( rc = slurm_shutdown_msg_conn ( sockfd ) ) == SLURM_SOCKET_ERROR )
return SLURM_SOCKET_ERROR ;
switch ( response_msg . msg_type ) /* slurm_update_node - update slurmctld node configuration per request */
{ int
case RESPONSE_SLURM_RC: slurm_update_node ( update_node_msg_t * node_msg )
rc_msg = ( return_code_msg_t * ) response_msg . data ; {
return (int) rc_msg->return_code ; return slurm_update ((void *) node_msg, REQUEST_UPDATE_NODE);
break ; }
default:
return SLURM_UNEXPECTED_MSG_ERROR ;
break ;
}
return SLURM_SUCCESS ; /* slurm_update_partition - update slurmctld partition configuration per request */
int
slurm_update_partition ( update_part_msg_t * part_msg )
{
return slurm_update ((void *) part_msg, REQUEST_UPDATE_PARTITION);
} }
int slurm_update_partition ( update_part_msg_t * desc_msg )
/* slurm_update - perform RPC for all update requests */
int
slurm_update (void * data, slurm_msg_type_t msg_type)
{ {
int msg_size; int msg_size;
int rc ; int rc ;
...@@ -77,13 +75,12 @@ int slurm_update_partition ( update_part_msg_t * desc_msg ) ...@@ -77,13 +75,12 @@ int slurm_update_partition ( update_part_msg_t * desc_msg )
return SLURM_SOCKET_ERROR ; return SLURM_SOCKET_ERROR ;
/* send request message */ /* send request message */
request_msg . msg_type = REQUEST_UPDATE_PARTITION ; request_msg . msg_type = msg_type ;
request_msg . data = desc_msg ; request_msg . data = data ;
if ( ( rc = slurm_send_controller_msg ( sockfd , & request_msg ) ) == SLURM_SOCKET_ERROR ) if ( ( rc = slurm_send_controller_msg ( sockfd , & request_msg ) ) == SLURM_SOCKET_ERROR )
return SLURM_SOCKET_ERROR ; return SLURM_SOCKET_ERROR ;
/* receive message */ /* receive message */
if ( ( msg_size = slurm_receive_msg ( sockfd , & response_msg ) ) == SLURM_SOCKET_ERROR ) if ( ( msg_size = slurm_receive_msg ( sockfd , & response_msg ) ) == SLURM_SOCKET_ERROR )
return SLURM_SOCKET_ERROR ; return SLURM_SOCKET_ERROR ;
......
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