Skip to content
Snippets Groups Projects
Commit 83599c2a authored by baigner's avatar baigner
Browse files

function_order is not saved for "incomplete" FPGs. Tried to fix it, doesn't work yet.

Former-commit-id: b9f5ddb71b22fe27f7324c5becfedc1354062287
parent 7cd2d13f
No related branches found
No related tags found
No related merge requests found
Pipeline #192810 canceled
......@@ -171,7 +171,7 @@ def kadmosExportAllGraphs():
else:
graph_name = graph.name
if isinstance(graph, FundamentalProblemGraph):
if not hasattr(graph.graph, 'problem_formulation'):
if not hasattr(graph, 'problem_formulation'):
graph.graph['problem_formulation'] = dict()
graph.graph['problem_formulation']['function_order'] = ""
graph.graph['problem_formulation']['mdao_architecture'] = "None"
......@@ -232,7 +232,7 @@ def kadmosExportGraph():
# Add problem function roles if they are not already existing
if isinstance(graph, FundamentalProblemGraph):
if not hasattr(graph.graph, 'problem_formulation'):
if not hasattr(graph, 'problem_formulation'):
graph.graph['problem_formulation'] = dict()
graph.graph['problem_formulation']['function_order'] = functionOrder
graph.graph['problem_formulation']['mdao_architecture'] = "None"
......@@ -358,10 +358,15 @@ def kadmosFindTempGraphs():
graph = load(os.path.join(tmpDir, graphFileName), file_check_critical=False)
mpg = None
# Use function order for VISTOMS if it is available in the graph information
function_order = None
if hasattr(graph, 'problem_formulation'):
function_order = graph.graph['problem_formulation']['function_order']
graph.save(os.path.join(UPLOAD_FOLDER, graphFileName), file_type="kdms",
graph_check_critical=False, mpg=mpg)
newVIstomsDataArray.append(graph.vistoms_add_json(graph_id=graphID,mpg=mpg))
newVIstomsDataArray.append(graph.vistoms_add_json(graph_id=graphID, function_order=function_order, mpg=mpg))
return jsonify(newVIstomsDataArray)
......@@ -403,9 +408,8 @@ def kadmosRevertLastStep():
# Get function_oder of the backup graph
function_order = None
if 'problem_formulation' in backupGraph.graph:
if 'function_order' in backupGraph.graph['problem_formulation']:
function_order = backupGraph.graph['problem_formulation']['function_order']
if hasattr(backupGraph.graph, 'problem_formulation'):
function_order = backupGraph.graph['problem_formulation']['function_order']
newVistomsData = backupGraph.vistoms_add_json(function_order=function_order, mpg=mpg, graph_id=graphID)
......@@ -1058,8 +1062,6 @@ def kadmosGetPossibleFunctionOrder():
graph = load(os.path.join(path, graphFileName), file_check_critical=False)
mpg = None
if isinstance(graph, FundamentalProblemGraph):
fpg = graph
else:
......@@ -1067,13 +1069,18 @@ def kadmosGetPossibleFunctionOrder():
# Getting the possible function order with the method specified by the user
function_order = fpg.get_possible_function_order(method)
if not hasattr(graph, 'problem_formulation'):
fpg.graph['problem_formulation'] = dict()
fpg.graph['problem_formulation']['mdao_architecture'] = "None"
fpg.graph['problem_formulation']['function_order'] = function_order
# Add the graph with the updated function order to VISTOMS
newVistomsData = fpg.vistoms_add_json(function_order=function_order, graph_id=graphID, mpg=mpg)
# Save the graph in temp/tmp.kdms
fpg.save(os.path.join(UPLOAD_FOLDER, TEMP_FILE+'_'+graphID+'.kdms'),
fpg.save(os.path.join(UPLOAD_FOLDER, TEMP_FILE + '_' + graphID + '.kdms'),
file_type='kdms', graph_check_critical=False, mpg=mpg)
# Add the graph with the updated function order to VISTOMS
newVistomsData = fpg.vistoms_add_json(function_order=function_order, graph_id=graphID, mpg=mpg)
return newVistomsData
except Exception as e:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment