Skip to content
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

Storing some key file locations in a preferences file #113

Open
jeffctaylor opened this issue Nov 26, 2015 · 7 comments
Open

Storing some key file locations in a preferences file #113

jeffctaylor opened this issue Nov 26, 2015 · 7 comments

Comments

@jeffctaylor
Copy link
Contributor

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
Copy link
Contributor

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 [email protected]
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
#113.

@low-sky
Copy link
Contributor

low-sky commented Nov 27, 2015

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor

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 [email protected]
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
#113 (comment).

@jeffctaylor
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants