From e391ed613f4d6b0125f91c3b5fb052145d474b2b Mon Sep 17 00:00:00 2001 From: FKHals <5229803-FKHals@users.noreply.gitlab.com> Date: Wed, 31 Aug 2022 17:00:44 +0200 Subject: [PATCH] Use csv-formatted values in message to agent so that it can be easier parsed using a saner alternative to sscanf() in the future. --- ompi/communicator/comm_init.c | 2 +- rank-swapper-agent/locserv.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ompi/communicator/comm_init.c b/ompi/communicator/comm_init.c index 1fb3295c23..6b81e04c90 100644 --- a/ompi/communicator/comm_init.c +++ b/ompi/communicator/comm_init.c @@ -119,7 +119,7 @@ static int getProcessAgentRank(uint32_t jobid, uint32_t vpid, size_t size) { char info_to_send[BUFFLEN]; snprintf(info_to_send, BUFFLEN+1, - "Spawned - PID: %d, vpid: %u, jobID: %u, size: %zu", + "%d,%u,%u,%zu", pid, vpid, jobid, size); if (send(fdSock, info_to_send, BUFFLEN+1, 0) < 0) { errorExit("send"); diff --git a/rank-swapper-agent/locserv.c b/rank-swapper-agent/locserv.c index eae21803b3..8bfde488ce 100644 --- a/rank-swapper-agent/locserv.c +++ b/rank-swapper-agent/locserv.c @@ -170,8 +170,8 @@ int main(void) { uint32_t vpid; uint32_t jobid; size_t size; - sscanf(client_message, "Spawned - PID: %d, vpid: %u, jobID: %u, size: %zu", &pid, &vpid, &jobid, &size); - //printf("\nCheck: PID: %d, vpid: %u, jobID: %u, size: %zu", pid, vpid, jobid, size); + sscanf(client_message, "%d,%u,%u,%zu", &pid, &vpid, &jobid, &size); + printf("Spawned - PID: %d, vpid: %u, jobID: %u, size: %zu\n", pid, vpid, jobid, size); uint32_t desiredRank = getDesiredVpid(jobid, vpid, size, &hstorage); -- GitLab