Open will-moore opened 4 years ago
Thanks for the feedback. Yes, making it pip installable was on my list, I fully agree.
Regarding the error you receive: Have you started Fiji manually? If yes, please close it before, since it's started automatically (in headless mode). This is done here: https://github.com/bene51/omero_3Dscript/blob/master/fiji.py#L30 Otherwise, you could start Fiji manually, but then you'd also need to start the "3Dscript Server" plugin manually, before you click the render button.
The function above is called once you click on start rendering, from here: https://github.com/bene51/omero_3Dscript/blob/master/fiji.py#L55 Is there any more information in the OMERO.web log file, or in the browser console? Can you find out which line causes the exception? It seems to be a python error, and from googling the error, I suspect it's the Popen() call https://github.com/bene51/omero_3Dscript/blob/master/fiji.py#L39
Thanks, Bene
I'm not enough into Django to judge whether this is relevant, but are you using the builtin Django web server or nginx?
Could you run the Fiji updater and update 3Dscript, before you do more testing? There was definitely an incompatibility there... Thanks
I see # startFiji(co)
commented out at https://github.com/bene51/omero_3Dscript/blob/21f05cca66c24329847146bddc6c580324552bff/fiji.py#L64.
Is it called somehow from anywhere else?
However, uncommenting that doesn't help. I updated 3D script just now:
I'm not using nginx (using Django dev server) but I don't think that would make a difference.
I found my ERROR: signal only works in main thread
above was actually being thrown in views.py by
with pid.PidFile('3Dscript', force_tmpdir=True) as p:
Leaving that aside for now (I removed that line since it didn't look essential for calling fiji.startRendering()
)?
Calling fiji.startRendering()
and un-commenting `# startFiji(co)
called startFiji(co)
, but this failed at https://github.com/bene51/omero_3Dscript/blob/21f05cca66c24329847146bddc6c580324552bff/fiji.py#L38 since fijibin
was None
.
fijibin = getFijiBin()
You're not calling checkFijiPath()
anywhere to assert this?
This was my error, since I hadn't set $FIJI_HOME
in the same environment I was running web.
Once I did that, the 3DScript seemed to run.
But ended with:
Cannot convert to MP4
java.lang.RuntimeException: Cannot convert to MP4
...Cannot run program \"ffmpeg\": error=2, No such file or directory
which is my fault for not installing ffmpeg
.
Having done that, I'm trying to re-run but finding that fiji.startRendering()
is just hanging now.
Will look again later...
Thanks for the details.
startFiji is called in the line above, in a separate thread: https://github.com/bene51/omero_3Dscript/blob/21f05cca66c24329847146bddc6c580324552bff/fiji.py#L63
Regarding FIJI_HOME or FIJI_BIN: It's probably best to make it an OMERO variable instead of an environment variable, what do you think?
The pid file is necessary for the following reason: This is assumed to run on the server, and Fiji will not be running by default. So when the first render command comes, it's starting fiji (in a separate thread, as mentioned) and then sends commands. However, it might well happen (especially since Fiji needs some time to start up) that 2 second user clicks the render button, and if Fiji is not fully started, it would open another Fiji. This would throw things over, as
But since you now reach ffmpeg, things look promising ;)
Thanks
Just to follow up on the signal issue: I installed a fresh OMERO.server & OMERO.web on my Mac, following https://docs.openmicroscopy.org/omero/5.6.2/sysadmins/unix/server-install-homebrew.html. I tested with nginx as well as with the Django built-in web server, but did not receive the signal error.
It's now pip installable: pip install omero-3Dscript
Apologies for my lack of Fiji knowledge, this was just what I tried...
I starting at https://github.com/bene51/omero_3Dscript/blob/master/README.md but I went a little "off-script" already since I'm installing on my local Mac laptop and I already have Fiji etc installed, so I just installed 3Dscript via the Fiji update manager and put the 3D_Animation_Server-0.1.jar under /Applications/Fiji.app/plugins. I set:
export FIJI_HOME="/Applications/Fiji.app/"
but wasn't sure from the install instructions whether I needed that in my omero-web environment?You'll want to make the app "pip installable". See https://packaging.python.org/tutorials/packaging-projects/#creating-setup-py
You should make the omero_3dscript package into a sub-directory of your repo (nest it one level deeper), and create a top-level setup.py (you can use the example from the link above as a starting point). This is what we do with all our OMERO.web apps. By using that example to create a
setup.py
and editing it to usename="omero_3dscript"
meant that I could do a install with$ pip install -e .
without worrying which directory I had cloned your repo (doesn't need to be in the omero-web $install_dir). The other steps to make the app 'pip installable' and push it to pypi are not too hard either and it's important if you want to make it easy for others to install.
You can then list 'pid' as a dependency in the
setup.py
and users won't have to install that manually.The other config and a web restart allowed me to open an image in the app via open-with...
But when I tried to startRendering I got "ERROR: signal only works in main thread". Is there a step I missing to start Fiji running headless? Animation_Server
Thanks, Will.