-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add --batch-mode parameter for better scripts support #209
Conversation
See: https://github.com/biolab/orange3/blob/master/Orange/canvas/run.py (biolab/orange3#5393) But note the warning. I would strongly recommend against using orange as a batch mode runner. |
@ales-erjavec Cool, I didn't know about that. Is there any mention about this in documentation? Why are you advising against using it? What can go wrong? What are the alternatives (except rewriting the workflow in Python)? |
I have encountered problem with running OWS that conatains Widget using WebviewWidget - it throws following error if I run it with Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/petr/.cache/pypoetry/virtualenvs/algops-containers-m_ElZcyi-py3.9/lib/python3.9/site-packages/Orange/canvas/run.py", line 86, in <module>
sys.exit(main(sys.argv))
File "/home/petr/.cache/pypoetry/virtualenvs/algops-containers-m_ElZcyi-py3.9/lib/python3.9/site-packages/Orange/canvas/run.py", line 59, in main
for _ in map(model.widget_for_node, model.nodes):
File "/home/petr/.cache/pypoetry/virtualenvs/algops-containers-m_ElZcyi-py3.9/lib/python3.9/site-packages/orangewidget/workflow/widgetsscheme.py", line 81, in widget_for_node
return self.widget_manager.widget_for_node(node)
File "/home/petr/.cache/pypoetry/virtualenvs/algops-containers-m_ElZcyi-py3.9/lib/python3.9/site-packages/orangecanvas/scheme/widgetmanager.py", line 213, in widget_for_node
self.ensure_created(node)
File "/home/petr/.cache/pypoetry/virtualenvs/algops-containers-m_ElZcyi-py3.9/lib/python3.9/site-packages/orangecanvas/scheme/widgetmanager.py", line 320, in ensure_created
self.__add_widget_for_node(node)
File "/home/petr/.cache/pypoetry/virtualenvs/algops-containers-m_ElZcyi-py3.9/lib/python3.9/site-packages/orangecanvas/scheme/widgetmanager.py", line 236, in __add_widget_for_node
w = self.create_widget_for_node(node)
File "/home/petr/.cache/pypoetry/virtualenvs/algops-containers-m_ElZcyi-py3.9/lib/python3.9/site-packages/orangewidget/workflow/widgetsscheme.py", line 300, in create_widget_for_node
widget = self.create_widget_instance(node)
File "/home/petr/.cache/pypoetry/virtualenvs/algops-containers-m_ElZcyi-py3.9/lib/python3.9/site-packages/orangewidget/workflow/widgetsscheme.py", line 400, in create_widget_instance
klass = name_lookup(desc.qualified_name)
File "/home/petr/.cache/pypoetry/virtualenvs/algops-containers-m_ElZcyi-py3.9/lib/python3.9/site-packages/orangecanvas/utils/__init__.py", line 86, in name_lookup
module = __import__(module_name, fromlist=[class_name])
File "/home/petr/.cache/pypoetry/virtualenvs/algops-containers-m_ElZcyi-py3.9/lib/python3.9/site-packages/orangecontrib/timeseries/widgets/owlinechart.py", line 29, in <module>
from orangecontrib.timeseries.widgets.highcharts import Highchart
File "/home/petr/.cache/pypoetry/virtualenvs/algops-containers-m_ElZcyi-py3.9/lib/python3.9/site-packages/orangecontrib/timeseries/widgets/highcharts/__init__.py", line 1, in <module>
from .highcharts import Highchart
File "/home/petr/.cache/pypoetry/virtualenvs/algops-containers-m_ElZcyi-py3.9/lib/python3.9/site-packages/orangecontrib/timeseries/widgets/highcharts/highcharts.py", line 15, in <module>
from Orange.widgets.utils.webview import WebviewWidget
ImportError: cannot import name 'WebviewWidget' from 'Orange.widgets.utils.webview' (/home/petr/.cache/pypoetry/virtualenvs/algops-containers-m_ElZcyi-py3.9/lib/python3.9/site-packages/Orange/widgets/utils/webview.py) The error is caused by complete lack of GUI. When I run it with my version of batch mode, it works without problems. @ales-erjavec Do you think, it is possible to modify your runner to run the GUI but exit after OWS is finished with some command line option? |
@PetrDlouhy, a long-term solution should (and will) be to remove highcharts from timeseries add-on - I believe this is the only first-party add-on that still uses it. Volunteering, maybe? |
@janezd I have the same problem also with Corpus Viewer But maybe the problem is not with the GUI itself. The import error in webview.py is this:
|
I found out, that the only thing needed for the workflow to run is to add one import to from Orange.widgets.utils.webview import WebviewWidget # noqa Imported to make webwidget addons work Although there are some curious warnings in the console:
|
Add parameter
--batch-mode
that exists Orange after the workflow is executed. Orange nonzero status if there was error during running the workflow.This very simple sollution far from what that @janezd suggested on biolab/orange3#4910. Still this solution can solve many use-cases of scripting workflows, especially with the headless solution I described there.