Skip to content

Commit

Permalink
Merge pull request #13 from VIDA-NYU/syncing-API-example
Browse files Browse the repository at this point in the history
reformat JSON
  • Loading branch information
raonilourenco authored Dec 8, 2024
2 parents 284ebff + 99ccb5e commit f2cfb09
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 66 deletions.
2 changes: 1 addition & 1 deletion bugdoc_api/bugdoc/algos/debugging_decision_trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def assembletests(self, moralflag, path):

def run(self, entry_point, input_dict, outputs=['results'], rebuild=True):
super().run(entry_point, input_dict, outputs=outputs)
self.allexperiments, self.allresults, self.pv_goodness = load_runs(self.entry_point + ".adb",
self.allexperiments, self.allresults, self.pv_goodness = load_runs(self.entry_point,
self.my_inputs)
logging.debug("pv_goodness is: " + str(self.pv_goodness))
logging.debug("allresults is: " + str(self.allresults))
Expand Down
2 changes: 1 addition & 1 deletion bugdoc_api/bugdoc/algos/shortcut.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def get_good_and_bad_instances(self, goodlist, badlist):

def run(self, entry_point, input_dict, outputs=['results']):
super().run(entry_point, input_dict, outputs=outputs)
self.allexperiments, self.allresults, _ = load_runs(self.entry_point + ".adb", self.my_inputs)
self.allexperiments, self.allresults, _ = load_runs(self.entry_point , self.my_inputs)
# logging.debug("allresults is: "+str(self.allresults))
requests = set()
expers = [self.allresults[j][:-1] for j in range(len(self.allresults))]
Expand Down
2 changes: 1 addition & 1 deletion bugdoc_api/bugdoc/algos/stacked_shortcut.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def get_good_and_bad_instances(self, goodlist, badlist):

def run(self, entry_point, input_dict, outputs=['results']):
super().run(entry_point, input_dict, outputs=outputs)
self.allexperiments, self.allresults, _ = load_runs(self.entry_point + ".adb", self.my_inputs)
self.allexperiments, self.allresults, _ = load_runs(self.entry_point, self.my_inputs)
logging.debug("allresults is: "+str(self.allresults))
requests = set()
expers = [self.allresults[j][:-1] for j in range(len(self.allresults))]
Expand Down
9 changes: 8 additions & 1 deletion bugdoc_api/bugdoc/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

import copy
import json
import logging
import os
import sys
import traceback
Expand All @@ -45,6 +46,8 @@
from builtins import range
from bugdoc.utils.combinatorial_design import generate_tuples

logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)

goodbad = [True, False]
numtests = 30

Expand Down Expand Up @@ -77,7 +80,7 @@ def load_runs(filename, input_keys, lims=None):
try:
exp = []
exp_dict = json.loads(e[:-1])

result_value = exp_dict['result']

for key in input_keys:
Expand Down Expand Up @@ -199,6 +202,10 @@ def record_pipeline_run(filename,values,parameters,result, origin=None):

if origin:
paramDict["origin"] = origin

logging.debug('Filename: ' + filename)
logging.debug('New configuration: ' + str(paramDict))

f = open(filename, "a")
f.write(json.dumps(paramDict) + '\n')
f.close()
Expand Down
2 changes: 1 addition & 1 deletion bugdoc_cli/bugdoc_cli_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ def main():
result = False
logging.error("-" * 60)

record_pipeline_run(entry_point + ".adb", values, parameters, result)
record_pipeline_run(entry_point, values, parameters, result)
values.append(result)
sender.send_string(str(values))
2 changes: 1 addition & 1 deletion examples/conf_my_api_example.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"entry_point": "my_pipeline",
"entry_point": "dataflow_pipeline.json",
"python_module": "my_api_example",
"run": "execute_pipeline",
"parameters": [
Expand Down
116 changes: 58 additions & 58 deletions examples/dataflow_pipeline.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# --------------------------------------
# We choose the Stacked Shortcut Algorithm to debug the pipeline.

from bugdoc.algos.stacked_shortcut import AutoDebug as StackedShortcut
from bugdoc.algos.stacked_shortcut import StackedShortcut

# %%
# Parameter space definition
Expand Down Expand Up @@ -72,7 +72,7 @@

root, _, _ = result
parameters = list(parameter_space.keys())
print('Root Cause: \\n%s' % (
print('Root Cause: \n%s' % (
' OR '.join(
[
' AND '.join(
Expand Down

0 comments on commit f2cfb09

Please sign in to comment.