Skip to content

Commit

Permalink
Use ID for metadata commands to enforce uniqueness. Fixes #1977 (#1980)
Browse files Browse the repository at this point in the history
  • Loading branch information
umesh-timalsina committed Nov 12, 2020
1 parent 387accb commit 69580c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions src/plugins/ExecuteJob/ExecuteJob.Metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ define([
trimStartRegex = new RegExp(CONSTANTS.START_CMD + '.*'),
matches,
content,
cmd;
cmd,
cmdId;

for (let i = 0; i < lines.length; i++) {
// Check for a deepforge command
Expand All @@ -77,13 +78,14 @@ define([
args = matches[m].split(/\s+/);
args.shift();
cmd = args[0];
content = matches[m].substring(matches[m].indexOf(cmd) + cmd.length);
cmdId = args[1];
content = matches[m].substring(matches[m].indexOf(cmdId) + cmdId.length);
if (!skip || cmdCnt >= this.lastAppliedCmd[jobId]) {
this.lastAppliedCmd[jobId]++;
await this.onMetadataCommand(
job,
cmd,
this.lastAppliedCmd[jobId],
+cmdId,
JSON.parse(content)
);
hasMetadata = true;
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/GenerateJob/templates/plotly_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ def show(block=None):
interactive versus batch mode
"""
for manager in Gcf.get_all_fig_managers():
manager.canvas.send_deepforge_update()
manager.canvas.send_deepforge_update(fig_num=manager.num)
pass


Expand Down Expand Up @@ -691,15 +691,15 @@ def draw(self):
"""
Draw the figure using the renderer
"""
self.send_deepforge_update()
self.send_deepforge_update(fig_num=plt.gcf().number)
renderer = RendererTemplate(self.figure.dpi)
self.figure.draw(renderer)

def send_deepforge_update(self):
def send_deepforge_update(self, fig_num):
state = self.figure_to_state()
# Probably should do some diff-ing if the state hasn't changed...
# TODO
print('deepforge-cmd PLOT ' + state)
print(f'deepforge-cmd PLOT {fig_num} ' + state)

def figure_to_state(self):
figure = self.figure
Expand Down

0 comments on commit 69580c7

Please sign in to comment.