Skip to content
Snippets Groups Projects
Commit e39a1c1f authored by imcovangent's avatar imcovangent
Browse files

Update on visualization package - part II

Former-commit-id: d4a72f8f520870dc1282836e21e412367c166329
parent 3ec073ab
No related branches found
No related tags found
No related merge requests found
Pipeline #192644 canceled
......@@ -42,7 +42,7 @@ rce_add_output_filters = True # Setting on whether to include output filters i
create_rcg_vis = True # Create RCG visualizations, set to False after first execution to save time
create_vis = True # Create visualisations
compress_vis = True # Automatically compress the visualization kadmos.external into zip files
vispack_version = '170523'
vispack_version = '170530'
# List of MDAO definitions that can be wrapped around the problem
mdao_definitions = ['unconverged-MDA-GS', # 0
......@@ -134,7 +134,6 @@ if create_rcg_vis:
RCG.graph['description'] = 'RCG'
RCG.create_visualization_package(vispack_dir + '_RCG',
order=functions,
no_circleView_variables_data=True,
compress=False,
vispack_version=vispack_version)
shutil.rmtree(vispack_dir, ignore_errors=True)
......@@ -323,7 +322,6 @@ for idx, item in enumerate(mdao_definitions):
if create_vis:
FPG.add_to_visualization_package(vispack_dir,
order=function_order,
no_circleView_variables_data=True,
compress=False,
vispack_version=vispack_version)
# Create DSM from FPG
......@@ -363,7 +361,7 @@ for idx, item in enumerate(mdao_definitions):
MDG.graph['description'] = 'XDSM_'+mdao_definition
if create_vis:
MDG.add_to_visualization_package(vispack_dir, MPG=MPG,
no_circleView_variables_data=True, compress=False,
compress=False,
vispack_version=vispack_version)
# Save Mdao
......
......@@ -187,9 +187,11 @@ class VispackMixin(object):
# CREATE TOOLS_DATA JSON
# Create empty dictionary circleView_tools_data
print 'Creating circleView_tools_data.json ...'
print 'Creating circleView_tools_data.json and serviceView_tools_data_list ...'
circleView_tools_data = dict(attributes=dict(tools=full_graph['attributes']['tools'],
variables=full_graph['attributes']['variables']))
serviceView_tools_data = dict(attributes=dict(tools=full_graph['attributes']['tools'],
variables=full_graph['attributes']['variables']))
# Setting for percentual progress
n_keys = len(full_graph.keys())
......@@ -201,10 +203,19 @@ class VispackMixin(object):
n_key += 1
if n_key in progress_keys:
print " progress: " + str((progress_keys.index(n_key)) * 10) + '%...'
progress.step(progress_keys.index(n_key)+10)
progress.step(progress_keys.index(n_key) + 10)
if key is not 'attributes' and key is not coordinator_str:
if self.node[key]['category'] == 'variable':
input_tools = full_graph[key]
# extend serviceView_tools_data with tool outputs
# TODO: if-statements can be adjusted / optimized!
for input_tool in input_tools:
if input_tool not in serviceView_tools_data:
serviceView_tools_data[input_tool] = dict(name=format_string_for_d3js(input_tool), input=[],
output=[key])
else:
serviceView_tools_data[input_tool]['output'] = extend_list_uniquely(
serviceView_tools_data[input_tool]['output'], [key])
# Create circleView_tools_data
for tool in full_graph['attributes']['tools']:
if key in full_graph[tool]:
......@@ -224,7 +235,8 @@ class VispackMixin(object):
if key in full_graph[coordinator_str]:
if coordinator_str not in circleView_tools_data:
circleView_tools_data[coordinator_str] = dict(name=format_string_for_d3js(coordinator_str),
input=[], pipeline_data=dict())
input=[],
pipeline_data=dict())
# Add input tools to coordinator
circleView_tools_data[coordinator_str]['input'] = extend_list_uniquely(
circleView_tools_data[coordinator_str]['input'], input_tools)
......@@ -236,6 +248,19 @@ class VispackMixin(object):
circleView_tools_data[coordinator_str]['pipeline_data'][input_tool], [key])
elif not self.node[key]['category'] == 'function':
raise NotImplementedError('Node category %s is not allowed.' % self.node[key]['category'])
if key is not 'attributes':
if key is coordinator_str:
if key not in serviceView_tools_data:
serviceView_tools_data[key] = dict(name=format_string_for_d3js(key), input=full_graph[key],
output=[])
else:
serviceView_tools_data[key]['input'] = full_graph[key]
elif self.node[key]['category'] == 'function':
if key not in serviceView_tools_data:
serviceView_tools_data[key] = dict(name=format_string_for_d3js(key), input=full_graph[key],
output=[])
else:
serviceView_tools_data[key]['input'] = full_graph[key]
# Export circleView_tools_data dictionary to list
circleView_tools_data_list = []
......@@ -250,7 +275,15 @@ class VispackMixin(object):
# Move and open json file
move_and_open(filename, destination_folder, open=open_files)
print 'Successfully created circleView_tools_data.json.'
# Export serviceView_tools_data dictionary to list
serviceView_tools_data_list = []
for key in serviceView_tools_data.iterkeys():
if key is not 'attributes':
new_dict = serviceView_tools_data[key]
new_dict['type'] = 'function'
serviceView_tools_data_list.append(new_dict)
print 'Successfully created circleView_tools_data.json and serviceView_tools_data_list.'
# CREATE VARIABLE TREE BASED ON SCHEMA
print 'Creating variableTree_dataschema.json ...'
......@@ -593,11 +626,6 @@ class VispackMixin(object):
dst = os.path.join(vispack_folder, 'supportFiles', 'json', 'circleLayout_01.json')
shutil.copyfile(src, dst)
# Service view
src = os.path.join(temp_d3js_folder, 'serviceView_tools_data.json')
dst = os.path.join(vispack_folder, 'supportFiles', 'json', 'serviceView_01.json')
shutil.copyfile(src, dst)
# XDSM
src = os.path.join(temp_d3js_folder, 'xdsm.json')
dst = os.path.join(vispack_folder, 'supportFiles', 'json', 'xdsm_01.json')
......@@ -697,7 +725,6 @@ class VispackMixin(object):
self.export_d3js_files(MPG=MPG, order=order,
destination_folder=temp_d3js_folder,
open_files=open_files,
no_circleView_variables_data=no_circleView_variables_data,
reference_file=reference_file)
# Copy json files into visualization package
......@@ -739,11 +766,6 @@ class VispackMixin(object):
dst = os.path.join(vispack_folder, 'supportFiles', 'json', 'circleLayout_' + graph_id_str + '.json')
shutil.copyfile(src, dst)
# Service view
src = os.path.join(temp_d3js_folder, 'serviceView_tools_data.json')
dst = os.path.join(vispack_folder, 'supportFiles', 'json', 'serviceView_' + graph_id_str + '.json')
shutil.copyfile(src, dst)
# XDSM
src = os.path.join(temp_d3js_folder, 'xdsm.json')
dst = os.path.join(vispack_folder, 'supportFiles', 'json', 'xdsm_' + graph_id_str + '.json')
......
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