Astroua / CARTAvis

Deprecated Repository for CARTA project. Refer to:
https://github.com/cartavis/carta
GNU General Public License v2.0
2 stars 7 forks source link

Storing some key file locations in a preferences file #113

Open jeffctaylor opened 9 years ago

jeffctaylor commented 9 years ago

The cartaview() task that I am developing for CASA currently has the following parameters:

raster - The full path of a compatible image file to load. executable - The full path of the Carta executable file. configFile - The full path of the cartavis config.json file. port - The port which will be used to send commands to Carta and receive results. htmlFile - The full path of the Carta desktopIndex.html file.

In the interest of making this task as easy to set up as possible, @low-sky has suggested storing most of these values in a preferences file - possibly even the config.json file itself - which could be polled by the cartaview() task instead of relying on the user figuring out which port to use, where the executable is located, etc. This file would be set on the first time CARTA is run post installation on a machine.

Does anyone have any thoughts on how this could be set up?

@astrilet @pfederl @slovelan @JimNrao (have I forgotten anyone?)

alexstrilets commented 9 years ago

port - can be stored in config.json htmlFile, executable - it all depends on where it is installed, in my bash config file I have variable $CARTAROOT which points to the root of installation, then htmlFile and executable are easily referenced relatively to that path. Not a good idea to store it in config.json as it might be dependant on user installation. configFile - usually in the user $HOME/.cartavis by default but what is the point of storing it in confug.json file if you need that variable to find config.json to begin with, we can safely assume that it is always there.

raster - every user will have different image files, how can we make sure that everyone has specific image file, in our carta instlation we provide sample images in $HOME/CARTA/Images directory. Does casa installation provide some common image files?

On Thu, Nov 26, 2015 at 1:43 PM, Jeff Taylor notifications@github.com wrote:

The cartaview() task that I am developing for CASA currently has the following parameters:

raster - The full path of a compatible image file to load. executable - The full path of the Carta executable file. configFile - The full path of the cartavis config.json file. port - The port which will be used to send commands to Carta and receive results. htmlFile - The full path of the Carta desktopIndex.html file.

In the interest of making this task as easy to set up as possible, @low-sky https://github.com/low-sky has suggested storing most of these values in a preferences file - possibly even the config.json file itself - which could be polled by the cartaview() task instead of relying on the user figuring out which port to use, where the executable is located, etc. This file would be set on the first time CARTA is run post installation on a machine.

Does anyone have any thoughts on how this could be set up?

@astrilet https://github.com/astrilet @pfederl https://github.com/pfederl @slovelan https://github.com/slovelan @JimNrao https://github.com/JimNrao (have I forgotten anyone?)

— Reply to this email directly or view it on GitHub https://github.com/Astroua/CARTAvis/issues/113.

low-sky commented 9 years ago

The raster keyword shouldn't be a preference since it depends on the per-use instance.

For the htmlFile and executable locations, I do not think we want to have the user specify. I would think that they would want to be set on install / first run of the application.

jeffctaylor commented 9 years ago

Yes, raster is the one thing that should be kept as a parameter for the cartaview() task, so we don't need to worry about storing it as a preference at all. If we do decide to use the config.json file to store these preferences in, then we also don't need to worry about the configFile preference, so that just leaves port, htmlFile, and executable.

I always use 9999 as my port - are there any arguments against using that as a default?

Are there default locations for htmlFile and executable that can be set? e.g. if a user installs a precompiled binary, can those values be captured and included in config.json?

jeffctaylor commented 9 years ago

I've been testing with a config file that looks like this, and it works:

{                                                                               
    "_comment" : "List of plugin directories",                                  
    "pluginDirs": [                                                             
    "$(APPDIR)/../plugins",                                                     
    "$(HOME)/.cartavis/plugins"                                                 
    ],
    "port" : "9999",
    "executable" : "/home/jeff/scratch/build/dev/cpp/desktop/desktop",
    "htmlFile" : "/home/jeff/dev/CARTAvis/carta/html5/desktop/desktopIndex.html"
}

Could something like that be automatically generated on install?

alexstrilets commented 9 years ago

last too lines can be automatically generated during install, i can also setup environment variable to point to these directories.

On Fri, Nov 27, 2015 at 2:26 PM, Jeff Taylor notifications@github.com wrote:

I've been testing with a config file that looks like this, and it works:

{ "_comment" : "List of plugin directories", "pluginDirs": [ "$(APPDIR)/../plugins", "$(HOME)/.cartavis/plugins" ], "port" : "9999", "executable" : "/home/jeff/scratch/build/dev/cpp/desktop/desktop", "htmlFile" : "/home/jeff/dev/CARTAvis/carta/html5/desktop/desktopIndex.html" }

Could something like that be automatically generated on install?

— Reply to this email directly or view it on GitHub https://github.com/Astroua/CARTAvis/issues/113#issuecomment-160206323.

jeffctaylor commented 8 years ago

Excellent. So if this format looks all right to everyone, I can keep developing the cartaview() task with that in mind; or if it needs to be tweaked a bit, that's fine too. At least I know now that this sort of setup works, so whatever we decide on should be fine.

jeffctaylor commented 8 years ago

As we discussed during last week's telecon, these values will actually go into a separate configuration file; let's call it scriptedConfig.json. It should look like this (for now):

{                                                                               
    "port" : "9999",
    "executable" : "/home/jeff/scratch/build/dev/cpp/desktop/desktop",
    "htmlFile" : "/home/jeff/dev/CARTAvis/carta/html5/desktop/desktopIndex.html"
}

All that is left now is for the file to be automatically generated, as the cartaview() task can already read the file and parse the values in it.