Skip to content

Commit

Permalink
sim: fixed returning message on job sumbit (and bug with adding activ…
Browse files Browse the repository at this point in the history
…e job for tracking), added calling sim_job_requested_kill_timelimit on REQUEST_TERMINATE_JOB
  • Loading branch information
nsimakov committed May 30, 2023
1 parent cf55c83 commit c4f77f2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
9 changes: 9 additions & 0 deletions contribs/sim/sim_sbatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,15 @@ extern void submit_job(sim_event_submit_batch_job_t* event_submit_batch_job)
// slurmctld_req(&req_msg);
rc = slurm_submit_batch_job(desc, &resp);
}
if(resp != NULL) {
// insert job to active simulated job list
if (active_job->job_id == 0) {
pthread_mutex_lock(&events_mutex);
active_job->job_id = resp->job_id;
event_submit_batch_job->job_id = resp->job_id;
pthread_mutex_unlock(&events_mutex);
}
}
if (rc >= 0)
break;
if (errno == ESLURM_ERROR_ON_DESC_TO_RECORD_COPY) {
Expand Down
3 changes: 3 additions & 0 deletions contribs/sim/slurmctld_agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ void agent_queue_request(agent_arg_t *agent_arg_ptr)
break;
case REQUEST_TERMINATE_JOB:
// this initiated from job_compleate by jobs finishing by themselves
// can be called again if there are problems
kill_job = (kill_job_msg_t*)agent_arg_ptr->msg_args;
sim_job_requested_kill_timelimit(kill_job->step_id.job_id);
call_slurmctld_agent_queue_request=false;
break;
case REQUEST_NODE_REGISTRATION_STATUS:
Expand Down
8 changes: 6 additions & 2 deletions src/common/slurm_protocol_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1996,18 +1996,22 @@ extern int slurm_send_node_msg(int fd, slurm_msg_t *msg)
{
msg_bufs_t buffers = { 0 };
int rc;
slurm_node_reg_resp_msg_t *node_reg_resp_msg;
#ifdef SLURM_SIMULATOR
if(sim_slurmctld_req_ref!=NULL && sim_request_msg !=NULL && sim_response_msg !=NULL) {
switch(sim_request_msg->msg_type) {
case MESSAGE_NODE_REGISTRATION_STATUS:
sim_response_msg->msg_type = msg->msg_type;
memcpy(sim_response_msg->data, msg->data, msg->data_size);
node_reg_resp_msg = (slurm_node_reg_resp_msg_t*)msg->data;
sim_response_msg->data = xmalloc(sizeof(slurm_node_reg_resp_msg_t));
memcpy(sim_response_msg->data, node_reg_resp_msg, sizeof(slurm_node_reg_resp_msg_t));
sim_response_msg->data_size = msg->data_size;
return SLURM_SUCCESS;
break;
case REQUEST_SUBMIT_BATCH_JOB:
sim_response_msg->msg_type = msg->msg_type;
memcpy(sim_response_msg->data, msg->data, msg->data_size);
sim_response_msg->data = xmalloc(sizeof(submit_response_msg_t));
memcpy(sim_response_msg->data, msg->data, sizeof(submit_response_msg_t));
sim_response_msg->data_size = msg->data_size;
return SLURM_SUCCESS;
break;
Expand Down
5 changes: 5 additions & 0 deletions src/slurmd/slurmd/slurmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,12 @@ extern int send_registration_msg(uint32_t status)
goto fail;
}

#ifdef SLURM_SIMULATOR
// @todo properly handle responce
resp_msg.data = NULL;
#endif
_handle_node_reg_resp(&resp_msg);

slurm_free_msg_data(resp_msg.msg_type, resp_msg.data);

if (errno) {
Expand Down

0 comments on commit c4f77f2

Please sign in to comment.