[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[IDV #QJR-730252]: ISL: Close an IDV display window after capturing an image, or better, dispense with a display window altogether



> Yuan,
> 
> I have a little bit of new insight into the problem of running the IDV 
> headlessly on a Mac.
> 
> First, I discovered that I had several problems with the X11 forwarding 
> configuration both on my Web server, virga.sfsu.edu <http://virga.sfsu.edu/> 
> (where I do my IDV bundle and ISL script development for the Web server) and 
> on my laptop at home (from which I log onto virga, which is 200 miles away). 
> I solved those problems by reinstalling XQuartz on both machines, specifying 
> in /etc/ssh/ssh_config on both machines a path to auth (which is included 
> with XQuartz), and making sure that X11 forwarding was enabled on both 
> machines. X11 forwarding now works as I expect it to.
> 
> Second, once that problem was fixed, I then discovered that I could run any 
> program that uses X-windows for graphical output in headless mode on virga. 
> As outlined by Suvy in his 2015 email contribution in the idvuser email 
> archives, I can set the DISPLAY variable from the command line or in scripts, 
> together with Xvfb (which is installed with XQuartz), run either from the 
> command line or in scripts, and entered either directly into a Mac Terminal 
> or XQuartz xterm window on virga via a VNC connection from my laptop (which 
> controls the remote screen on virga) or via an ssh connection to virga from 
> my laptop, and run programs that rely on X-windows for graphical display, in 
> headless mode.
> 
> For example, WXP (Dan Vietor’s weather graphics package from the 1990s and 
> early 2000s) uses X-Windows for graphical display, and virga runs WXP 
> programs to create GIF imagery, both on cron schedules and triggered by the 
> LDM. Until today those programs required that a monitor be attached to virga 
> and that XQuartz be running continuously so that the WXP programs could open 
> an X-window, create a display, and save the display as a GIF image. However, 
> I’ve now reconfigured these programs to run headlessly, essentially as 
> follows:
> 
> export DISPLAY=:DISPLAY#  (Example of a DISPLAY#:  :99)
> Xvfb :DISPLAY# &
> export DISPLAY=:DISPLAY#
> Run any WXP program that generates GIF images
> 
> This works successfully, and I no longer have X-windows popping up all the 
> time on virga when I’m trying to do something else there via a VNC 
> connection, a real annoyance.
> 
> Unfortunately, the IDV on a Mac does not rely on X-windows to create 
> graphical displays, so none of this makes a whit of difference. As one 
> pie-in-the-sky solution, Is it possible to tell the IDV to address its 
> graphical output to an X-window on a Mac? That might solve the problem. (I 
> wouldn’t want to installer a virtual LINUX operating system on my Mac and run 
> the IDV from within it, though!)
> 
> Second, on another front, I tried adding "-Djava.awt.headless=true” to the 
> java command line run by the runIDV script. The IDV java command then looks 
> like this:
> 
> /Applications/IDV/jre.bundle/Contents/Home/jre/bin/java 
> -Djava.awt.headless=true 
> -Djava.ext.dirs=/Applications/IDV/jre.bundle/Contents/Home/jre/lib/ext/ 
> -Xdock:name=IDV -Xmx3072m  -XX:+DisableExplicitGC -Didv.enableStereo=false 
> -jar /Applications/IDV/idv.jar
> 
> Running this command produces the following Java error messages:
> 
> ERROR: Fatal error initializing resources
> java.awt.HeadlessException
> Exception in thread "main" java.awt.HeadlessException
> at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:207)
> at java.awt.Window.<init>(Window.java:536)
> at java.awt.Frame.<init>(Frame.java:420)
> at java.awt.Frame.<init>(Frame.java:385)
> at 
> javax.swing.SwingUtilities$SharedOwnerFrame.<init>(SwingUtilities.java:1758)
> at javax.swing.SwingUtilities.getSharedOwnerFrame(SwingUtilities.java:1833)
> at javax.swing.JDialog.<init>(JDialog.java:272)
> at ucar.unidata.util.GuiUtils.createDialog(GuiUtils.java:2281)
> at ucar.unidata.util.LogUtil.printException(LogUtil.java:913)
> at ucar.unidata.util.LogUtil.printException(LogUtil.java:822)
> at 
> ucar.unidata.idv.IntegratedDataViewer.logException(IntegratedDataViewer.java:3063)
> at ucar.unidata.idv.IntegratedDataViewer.<init>(IntegratedDataViewer.java:309)
> at ucar.unidata.idv.IntegratedDataViewer.<init>(IntegratedDataViewer.java:224)
> at ucar.unidata.idv.DefaultIdv.<init>(DefaultIdv.java:69)
> at ucar.unidata.idv.DefaultIdv.main(DefaultIdv.java:150)
> 
> — Dave
> 
> ***************************************************************
> * Dr. Dave Dempsey, Prof. Emeritus  |       ^    ___    \|/   *
> * Dept. of Earth & Climate Sciences |  )   ^   /||_||\ —-0—-  *
> * San Francisco State University    | )  )    / ||_|| \ /|\   *
> * 1600 Holloway Ave.                |  )  )  /  ||_||  \      *
> * San Francisco, CA   94132         |  )  ) /   ||_||   \  ^  *
> *                                   | )  )  )   ||_||    \    *
> * Cell:   (415) 802-5548            |  )  )  )~~||~||~~~~~\~~ *
> * Email:  address@hidden          | )  )  )  ) ~  ~ ~ ~ ~ ~ *
> ***************************************************************
> 
> > On Apr 17, 2020, at 11:10 AM, Unidata IDV Support <address@hidden> wrote:
> >
Well, I really have no idea how to help, you get more knowledge in this area. 
The only thing I can tell is that your choice of adding headless
in the runIDV script is not a good idea and it will not work.

let me know if you eventually get the solution and it will benefit other IDV 
users.

Yuan

Ticket Details
===================
Ticket ID: QJR-730252
Department: Support IDV
Priority: Normal
Status: Open
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.