Skip to content

Commit f5b86ae

Browse files
matysonmarcus-oscarsson
authored andcommitted
check if beamline workflow is not None before getting available workflows
this enables workflow to be optional in the beamline_config yaml
1 parent 659c43f commit f5b86ae

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

mxcubeweb/core/components/workflow.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,21 @@ def get_available_workflows(self):
1515
workflows = {}
1616
beamline = HWR.beamline
1717

18-
try:
19-
for wf in beamline.workflow.get_available_workflows():
20-
# Rename name and path to wfname and wfpath in order to avoid name
21-
# clashes
22-
wf["wfname"] = wf.pop("name")
23-
wf["wfpath"] = wf.pop("path")
24-
25-
workflows[wf["wfname"]] = wf
26-
except Exception:
27-
msg = "Problem with available workflows or naming/pathing: {wf.name}"
28-
hwr_logger.exception(msg)
29-
30-
if getattr(beamline, "gphl_workflow", None):
18+
if beamline.workflow:
19+
# Add workflows if available
20+
try:
21+
for wf in beamline.workflow.get_available_workflows():
22+
# Rename name and path to wfname and wfpath in order to avoid name
23+
# clashes
24+
wf["wfname"] = wf.pop("name")
25+
wf["wfpath"] = wf.pop("path")
26+
27+
workflows[wf["wfname"]] = wf
28+
except Exception:
29+
msg = "Problem with available workflows or naming/pathing: {wf.name}"
30+
hwr_logger.exception(msg)
31+
32+
if beamline.gphl_workflow:
3133
# Add Global Phasing workflows if available
3234
workflows.update(beamline.gphl_workflow.get_available_workflows())
3335

0 commit comments

Comments
 (0)