Skip to content

Commit

Permalink
remove conversion from int
Browse files Browse the repository at this point in the history
  • Loading branch information
tphung3 committed Nov 11, 2024
1 parent c470ee3 commit 41fc363
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 15 deletions.
13 changes: 0 additions & 13 deletions taskvine/src/manager/vine_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -1002,19 +1002,6 @@ char *vine_task_to_json(struct vine_task *t)
return json;
}

/* Converts an int64_t to a valid vine_task_func_exec_mode_t.
* Returns VINE_TASK_FUNC_EXEC_MODE_INVALID if there's no valid mode for the integer. */
vine_task_func_exec_mode_t vine_task_func_exec_mode_from_int64_t(int64_t n)
{
if (n == 1) {
return VINE_TASK_FUNC_EXEC_MODE_DIRECT;
}
if (n == 2) {
return VINE_TASK_FUNC_EXEC_MODE_FORK;
}
return VINE_TASK_FUNC_EXEC_MODE_INVALID;
}

/* Converts a string to a valid vine_task_func_exec_mode_t.
* Returns VINE_TASK_FUNC_EXEC_MODE_INVALID if there's no valid mode for the string. */
vine_task_func_exec_mode_t vine_task_func_exec_mode_from_string(const char *exec_mode)
Expand Down
1 change: 0 additions & 1 deletion taskvine/src/manager/vine_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ const char *vine_task_state_to_string( vine_task_state_t task_state );
struct jx * vine_task_to_jx( struct vine_manager *q, struct vine_task *t );
char * vine_task_to_json(struct vine_task *t);

vine_task_func_exec_mode_t vine_task_func_exec_mode_from_int64_t(int64_t n);
vine_task_func_exec_mode_t vine_task_func_exec_mode_from_string(const char *exec_mode);


Expand Down
2 changes: 1 addition & 1 deletion taskvine/src/worker/vine_worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ static struct vine_task *do_task_body(struct link *manager, int task_id, time_t
/* Also set the total number determined by the manager. */
task->function_slots_total = n;
} else if (sscanf(line, "func_exec_mode %" PRId64, &n) == 1) {
vine_task_func_exec_mode_t func_exec_mode = vine_task_func_exec_mode_from_int64_t(n);
vine_task_func_exec_mode_t func_exec_mode = n;
if (func_exec_mode == VINE_TASK_FUNC_EXEC_MODE_INVALID) {
debug(D_VINE | D_NOTICE, "invalid func_exec_mode from manager: %s", line);
vine_task_delete(task);
Expand Down

0 comments on commit 41fc363

Please sign in to comment.