Skip to content

Commit

Permalink
Refactor: code cleanup; Fix: location vs. location_name confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
LuckierDodge committed Oct 26, 2023
1 parent 1da62f8 commit cd1bdb0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion tests/manual_test/run_manual_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def main():
exp.register_exp()
# This runs the simulated_workflow a simulated workflow
flow_info_1 = exp.start_run(wf_path.resolve(), simulate=False, blocking=False)
#flow_info_2 = exp.start_run(wf_path.resolve(), simulate=False, blocking=False)
# flow_info_2 = exp.start_run(wf_path.resolve(), simulate=False, blocking=False)
# This checks the state of the flows in the queue
flows = exp.await_runs([flow_info_1["run_id"]])
# This will print out the queued job
Expand Down
11 changes: 4 additions & 7 deletions wei/core/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ def init_flow(
# Start executing the steps
steps = []
for module in self.workflow.modules:
if not(workcell.find_step_module(module.name)):

if not (workcell.find_step_module(module.name)):
raise ValueError(
f"Module {module} not in Workcell {self.workflow.modules}"
)
Expand All @@ -145,11 +144,9 @@ def init_flow(
valid = False
for module in self.workflow.modules:
if step.module == module.name:
valid = True
if not(valid):
raise ValueError(
f"Module {step.module} not in flow modules"
)
valid = True
if not (valid):
raise ValueError(f"Module {step.module} not in flow modules")
# replace position names with actual positions
if (
isinstance(step.args, dict)
Expand Down
10 changes: 5 additions & 5 deletions wei/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,18 @@ def run(self, args: Namespace): # noqa
module.state = ModuleStatus.INIT
self.state.set_module(module.name, module)
for module_name in self.workcell.locations:
for location, coordinates in self.workcell.locations[
for location_name, coordinates in self.workcell.locations[
module_name
].items():
try:
self.state.get_location(location)
location = self.state.get_location(location_name)
location.coordinates[module_name] = coordinates
self.state.set_location()
self.state.set_location(location_name, location)
except KeyError:
self.state.set_location(
location,
location_name,
Location(
name=location,
name=location_name,
coordinates={module_name: coordinates},
state="Empty",
queue=[],
Expand Down

0 comments on commit cd1bdb0

Please sign in to comment.