Skip to content

Commit

Permalink
fixed small implemation bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dai Yang authored and twittidai committed Jan 24, 2019
1 parent 5175636 commit a264190
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
21 changes: 10 additions & 11 deletions external/file/fileagent.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ int parse_file(FILE * fh, int* n_f, node_uid_t* failed_node, node_uid_t** destin
i++;
node = yaml_document_get_node(&doc, i);
}
*n_f = num_failed;
*n_f = 1;

//FIXME: num_failed is the number of destinations

for(int k = 0 ; k < num_failed; k++ )
{
Expand All @@ -129,7 +131,7 @@ int parse_file(FILE * fh, int* n_f, node_uid_t* failed_node, node_uid_t** destin

void mqtt_getfailed(
int* n_failed,
node_uid_t** result
node_uid_t* result
){
//(1)chek if file exists
FILE *fh = fopen ("evacuation.yaml", "r");
Expand All @@ -141,16 +143,13 @@ void mqtt_getfailed(

}else{
// (3)if exists parse file & (4)fill result and n_failed
node_uid_t test;
parse_file(fh, n_failed, &test ,result );
printf("%s\n", test.uid);
node_uid_t* targets;
parse_file(fh, n_failed, result,&targets );
DEBUG_PRINT("n_failed: % d \n",*n_failed);
for(int k = 0 ; k < *n_failed; k++ )
{
DEBUG_PRINT(" Res: %s - % dtar \n",((*result)+k)->uid, k);
fflush(stdout);
}

//for(int k = 0 ; k < *n_failed; k++ )
//{
// DEBUG_PRINT(" Res: %s - % dtar \n",((*result)+k)->uid, k);
//}
}

}
Expand Down
2 changes: 1 addition & 1 deletion include/laik/agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ typedef void (*laik_agent_reset) (void);
* @retval
*/
//TODO: Changed !! needs to be propagated to other tools !!!!
typedef void (*laik_agent_get_failed) (int*, node_uid_t**);
typedef void (*laik_agent_get_failed) (int*, node_uid_t*);
//typedef void (*laik_agent_get_failed) (int*, node_uid_t* );

/**
Expand Down
9 changes: 2 additions & 7 deletions src/external.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ void laik_ext_load_agent_from_file (
if(instance->repart_ctrl == NULL){
laik_ext_init(instance);
}
printf("blob1 \n");
ctrl = instance->repart_ctrl;

//ensure less than MAX_AGENT
Expand All @@ -134,16 +133,14 @@ void laik_ext_load_agent_from_file (
init = probfunc(handle, "agent_init");
assert(init);

printf("blob1 \n");

agent = init(argc, argv );
//argv = {"localhost","1883",top_name };
assert(agent);

ctrl->agents[ctrl->num_agents] = agent;
ctrl->num_agents++;
ctrl->handles[ctrl->num_agents] = handle;
printf("laik_ext_load_agent done ! L:2 \n");
laik_log(LAIK_LL_Debug, "laik_ext_load_agent done ! L:2 \n");
}

/**
Expand Down Expand Up @@ -258,7 +255,7 @@ void laik_get_failed (
// (1) Get a list of node_uids


fta->getfail(num_failed, &failed_ranks);
fta->getfail(num_failed, failed_ranks);

//printf("fta-> getfail: %d \n", *num_failed);
for(int k = 0 ; k < *num_failed; k++ )
Expand Down Expand Up @@ -294,8 +291,6 @@ void laik_get_failed (
void laik_ext_init (
Laik_Instance* inst
){
printf("bloblobl");

assert(inst);

Laik_RepartitionControl* ctrl;
Expand Down

0 comments on commit a264190

Please sign in to comment.