Skip to content

Commit

Permalink
Added missing function
Browse files Browse the repository at this point in the history
  • Loading branch information
IKCAP committed Oct 25, 2021
1 parent a1b6901 commit 82357e9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
38 changes: 36 additions & 2 deletions src/classes/graphql/graphql_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,42 @@ export const modelEnsembleFromGQL = (dbs: any[], pbs: any[]): ModelIOBindings =>
return bindings;
}

export const executionToGQL = (ex: Execution) => {
return null;
export const executionToGQL = (ex: Execution) : any => {
let exobj = {
id: ex.id,
model_id: ex.modelid,
status: ex.status,
start_time: ex.start_time,
execution_engine: ex.execution_engine,
run_progress: ex.run_progress,
run_id: ex.runid,
parameter_bindings: {
data: [] as any
},
data_bindings: {
data: [] as any
},
results: {
data: [] as any
}
}
Object.keys(ex.bindings).forEach((ioid) => {
let binding = ex.bindings[ioid];
if (typeof(binding) == 'string') {
exobj.parameter_bindings.data.push({
model_parameter_id: ioid,
parameter_value: binding+"",
})
}
else {
exobj.data_bindings.data.push({
model_io_id: ioid,
resource_id: binding["id"]
})
}
})
exobj.results.data = executionResultsToGQL(ex.results);
return exobj;
}

export const executionFromGQL = (ex: any, emulator=false) : Execution => {
Expand Down
2 changes: 1 addition & 1 deletion src/classes/mint/mint-local-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export const deleteExecutableCacheForModelLocally = async(modelid: string,
let thread_model_id = thread.model_ensembles[modelid].id;
let all_execution_ids = await getThreadModelExecutionIds(thread_model_id);

// Delete existing thread execution ids (*NOT DELETING GLOBAL ENSEMBLE DOCUMENTS .. Only clearing list of the thread's execution ids)
// Delete existing thread execution ids (*NOT* deleting global execution records .. Only clearing list of the thread's execution id mappings)
deleteThreadModelExecutionIds(thread_model_id);

// Work in batches
Expand Down

0 comments on commit 82357e9

Please # to comment.