-
Notifications
You must be signed in to change notification settings - Fork 0
CO2MPAS model graph "Not Found" error #146
Comments
@vinci1it2000 any idea? |
This does not work in the console either, should not we transfer in co2mpas? [Edit] speaking with @tansial, he confirmed that this works from console |
@tansial, @dimitriskomnos and @vinci1it2000 it works for me from wui and console, though instead calculate precondition output does not work both from co2wui and from console. I get this error message when I kill the process: from console:
and from co2wui:
|
@stefanocorsi should be the problem of the exe that doesn’t include the graphviz library. I’m moving to the forge. |
@tansial regarding the bypass, the name is normal because is the function used inside the model. |
I'm sure Besides, it wouldn't work for all diagrams, not just for some of them, towards the bottom, correct? |
@vinci1it2000 @stefanocorsi i've been thinking that we can improve a lot the way graphs are rendered. Other alternatives are D3.js & bokeh, but there are curated list of tools for that: |
@ankostis that seems a great idea. Next release? |
Certainly! |
Some data/evidence gathered today for @vinci1it2000 and @ankostis in order to help me diagnose the causes of this issue:
Conclusions:
At this point, two possible causes for the issue we are discussing come to my mind: a) The flask server launched by the plot does not inherit or does not set the correct PATH environment |
Here the error message when I try to plot.
|
@vinci1it2000 I think I have a clue regarding this issue. When I start "co2mpas plot" from the console provided by the executable installer, I get this message:
I would concentrate on this part of the message:
I wonder if somewhere in the schedula code, UNC paths are used to be passed on to the dot intepreter... In particular I'm looking at this code:
In utils.py in schedula. I'm doing some tests now removing the line and also investigating what this means for windows and multiplatform usage. |
@vinci1it2000 update: it works when the line is changed to this:
|
(I know it's not my business..) |
Issue reported on vinci1it2000/schedula#16. For this release, any fix there would suffice (@stefanocorsi a newschedula release may require a new rebuild of the EXE). For the next release, i would like to see a "decoupled" solution, where |
It is decoupled. You can overwrite the flask parameters using the kwargs of the |
@ankostis why there is a CMD.EXE invoked? This should be your business. @stefanocorsi anyway we don't need any new release of schedula. When co2mpas is launched from CMD.EXE you can use the following patch:
|
Is it possible that setting UNC to '' will create problems to long paths (limit 256 chars)? |
That problem persist. |
I don't know where (or if)
With "decoupling" i meant the opposite: Instead of In essence, schedula must not start up any server.
Please discuss in vinci1it2000/schedula#16 how to make it less persistent. |
@vinci1it2000 do you need further clarifications in regards to @ankostis request above ? This is a top-priority issue so we need to fix asap. Please clarify if u need any further assistance. |
To clarify, we don't want the "decoupled" solution now. We need to know if the proposed monkeypatch to drop UNCs |
@spycon69 I said that the issue is not schedula. The problem is |
@ankostis regarding your previous #146 (comment). The alternative is to iterate over the attribute of the Flask app |
Vinci, you didn't notice that the problem affects even also the Additionally, it is Finally, and most fundamentally, why you had to provide a "dispatcher API" for plain tasks like this
Regarding the decoupling, this seems like another hack, which i'm not sure it would work in all occasions. |
Yes, you missed one stuff. This error appears only on the exe. I cannot reproduce on my window. This problem belong to the jrcstu-forge.
Yes.
No. You can read the first answare.
You know why. The rendering of the model graph takes time so with the API you have the plot generated ondemand.
I cannot understand why you want the flask bluprint and how it can solve the problem with the UNC paths, CMD.EXE, and DOT. |
@stefanocorsi @dimitriskomnos @sapofra is this true?
Use the Vagrant VM then.
Because that is why flask-blueprints exist. On the contrary, from a quick search I could not find any similar recipe for transplanting flask rules.
It won't. |
In the jrc desktop in the release 4.1.1 it worked in the console and it was giving error in the WUI. Also, in the jrc desktop I tried with the downloaded projects the latest versions of co2wui and co2mpas (v4.1.2), using the windows cmd, and the model graph was working from both cmd and WUI. |
ResearchLaunching Vagrant: W10-client, installing My purpose is to find who is calling the I know that I visit its sources, and decide that i want to insert a I need to find it in the local filesystem and edit its sources: (base) C:\Users\vagrant\Documents>python
Python 3.7.3 | packaged by conda-forge | (default, Jul 1 2019, 22:01:29) [MSC v.1900 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from graphviz import backend
>>> backend.__file__
'C:\\Users\\vagrant\\CO2MPAS\\lib\\site-packages\\graphviz\\backend.py'
>>> I edit the above file and insert a (base) C:\Users\vagrant\Documents>co2mpas plot
* Serving Flask app "C:\Users\vagrant\Documents\cache_plot" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
2019-10-14 21:55:12,578: INFO:werkzeug: * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
2019-10-14 21:55:13,634: INFO:co2mpas:Done! [14.77 sec]
> c:\users\vagrant\co2mpas\lib\site-packages\graphviz\backend.py(160)run()
-> try: Ok, debugger has landed where we planed.
and confirmed that But why?? Strangely enough, changing-dir (CD) to a UNC-path is ok:
So here is one prospective fix: change-dir before calling Graphviz. Let's inspect the command:
Oups, maybe this is the problem, it is not First we have to locate the
So Let's copy that in the clipboard and use it in debugger to change the route of things...
... and continue
Yeap, it worked! We have found 2 workarounds, but still have not discovered why it runs on some cases? From is the history of the file we cannot fins the content! Let's visit the stacktrace to see who is building the command: (Pdb) up
> c:\users\vagrant\co2mpas\lib\site-packages\graphviz\backend.py(209)render()
-> run(cmd, capture_output=True, cwd=cwd, check=True, quiet=quiet)
(Pdb) l
202 dirname, filename = os.path.split(filepath)
203 cmd, rendered = command(engine, format, filename, renderer, formatter)
204 if dirname:
205 cwd = dirname
206 rendered = os.path.join(dirname, rendered)
207 else:
208 cwd = None
209 -> run(cmd, capture_output=True, cwd=cwd, check=True, quiet=quiet)
210 return rendered So it is And the same from the local file: (Pdb) l 110, 136
110 def command(engine, format_, filepath=None, renderer=None, formatter=None):
111 """Return args list for ``subprocess.Popen`` and name of the rendered file."""
...
124
125 -> if PLATFORM == 'windows':
126 engine = '%s.bat' % engine
127 output_format = [f for f in (format_, renderer, formatter) if f is not None]
128 cmd = [engine, '-T%s' % ':'.join(output_format)]
129 rendered = None
130
...
136 return cmd, rendered
( Actually there are 2 extra lines (125 & 126) in our local version of the file that append the From the history of the file in GitHb we cannot find that content. So it must have been added by the conda recipe. build:
number: 0
noarch: python
script:
# Needed due to the Windows batch script wrappers in conda-forge Graphviz.
# see https://github.com/conda-forge/graphviz-feedstock/blob/bbfe3c7be2a448dd11db165a18c3edfd5ee6a95d/recipe/bld.bat#L27-L32
# Must patch manually as the source code and patch are CRLF and conda-build
# tries to convert the patch to LF, which then won't apply.
- pushd "{{ RECIPE_DIR }}"
- cp windows-bat.patch "{{ SRC_DIR }}"
- popd
ConclusionsWe unraveled the mystery:
|
@vinci1it2000 i didn't expect you to know how to navigate conda feedstock, but the debugging of flask + python-graphviz launching Graphviz(the But to start doing it, you first had to reproduce the errors. It is not the 1st time this has happened. |
@ankostis thanks for the well-documented explanation. To my understanding both of the proposed workaround could resolve the issue. But which is the one you propose in regards to stability & effort time ? |
@ankostis great analysis, thanks! Have you already investigated why the conda recipe patches backend.py by inserting the call to the auto-generated batch files? Do we simply remove this behavior from the recipe or how would you suggest to proceed? |
They say here: conda-forge/python-graphviz-feedstock@afb92f9#diff-e13440d91bcaaab030104d60f0ade38a
Could we not (I know this is over-simplification) change the recipe for graphviz from this:
to this:
because at the end of the day the only thing that the .bat file does is calling the exe... |
Update: I can confirm the fix suggested by @ankostis works... at least on the vagrant machine. So if we simply could change in the graphviz recipe from :
the plots would display correctly. What do you @ankostis and @vinci1it2000 think? |
Yes, Research (continued)Some further links on the conda's decision to use
Given all this read, its good to know that the forthcoming Workaround:We have to monkey patch [edit:] It's definitely Workaround for
|
I can do a PR for co2mpas. @vinci1it2000 in which co2mpas-module would you like me to put the monkeypatch code, so as to run only once when |
@ankostis I disagree with your suggestion of doing the monkey patch in schedula. This problem belongs to jrcstu-forge and conda. Moreover, the patch that you suggested is not applicable when graphviz is installed from pip. This is the reason why I cannot reproduce the error on my window and why I told you several times that the problem is on the exe and not in schedula. Regarding your comment #146 (comment), honestly, I can just say that this is not the way to work. I'm really disappointed for how you behave. Ah just to know, I wrote #146 (comment) with the account of @sapofra. |
@stefanocorsi The easiest solution is to add a recipe in jrcstu-forge for graphviz without the conda patch. This will solve all issues. We have to tackle the source of the issue. |
SUMMARY: Feedstocking our own Our problem is like this:
To give you an example, if |
I know. Please reply to my technical question to close this asap. |
Sorry, but your analysis was wrong. You installed the wrong library (vinci1it2000/schedula#16 (comment)). Please, next time be more accurate on the thing that you do and polite, we lost almost two weeks for a wrong package that you installed. Please apply the fix suggested in JRCSTU/jrcstu-forge#7. |
You did this mistake 11 days ago, and you continue. In conda you need BOTH packages, not ONE or the OTHER as you seem to suggest.
|
Please, once again, don't close issues prematurely. |
@ankostis @vinci1it2000 github is NOT the place for personal arguments. I am sure that we can discuss in another meeting this and any other pending issues. So PLEASE lets put aside personal arguments and focus on resolution and not argument. Thank you both. |
I downloaded version 4.0.2 and started testing.
There are links in the model graph that will return the "Not Found" error.
I didn't find a correlation for the ones that are not working, you can find non-working links in many different subsections.
Example: core -> CO2MPAS model -> calculate_precondition_output -> after_treat_model
--->
--->
but already CO2MPAS model clickable link returns the error.
It is the same if I open from the co2wui or the consolle.
Furthermore, I see some clickable items I didn't expect to be there: bypass, selector, domain...
Are they supposed to be there?
The text was updated successfully, but these errors were encountered: