Skip to content

Commit

Permalink
feat: Added support for backward compatibility in states
Browse files Browse the repository at this point in the history
  • Loading branch information
Aradhya-Tripathi committed Apr 2, 2022
1 parent 339875b commit a1a35ee
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion bench/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,22 @@ def set_states(self):
self.states = {}

def update_apps_states(self, app_name: Union[str, None] = None, branch: Union[str, None] = None, required:List = []):
if self.apps and not os.path.exists(self.states_path):
# idx according to apps listed in apps.txt (backwards compatibility)
print("Found existing apps updating states...")
for idx, app in enumerate(self.apps, start=1):
self.states[app] = {
"resolution": {
"commit_hash": None,
"branch": None
},
"required": required,
"idx": idx,
"version": get_current_version(app, self.bench.name),
}
with open(self.states_path, "w") as f:
f.write(json.dumps(self.states, indent=4))

apps_to_remove = []
for app in self.states:
if app not in self.apps:
Expand Down Expand Up @@ -199,7 +215,7 @@ def update_apps_states(self, app_name: Union[str, None] = None, branch: Union[st
"branch": branch
},
"required":required,
"order of install":len(self.states) + 1,
"idx":len(self.states) + 1,
"version": version,
}

Expand Down

0 comments on commit a1a35ee

Please sign in to comment.