Skip to content

GMT should not download the gmt_data_server.txt file if no remote files are used #3609

Closed

Description

@seisman

Every gmt command checks if gmt_data_server.txt and gmt_hash_server.txt exist locally. If not, GMT will download these two files from the GMT data server. GMT command also checks if these two files are older than 24 hours and try to refresh them if they are. It works well for users with good internet connections and users without internet connections.

However, it's a terrible experience for users who have very slow internet connections or work with intranet (intranet has network connections but can't visit external websites). Every time they run a gmt command, they need to wait for the timeout of the GMT server (~30 s). They won't understand why GMT is so slow, since the timeout message is not shown unless -Vi is used. Even -Vi is used, they may still be confused why GMT tries to download the two files even though they don't use any remote files like @earth_relief_01d.

IMHO, it's not a good design to let gmt check and download the two files every time. A better behavior is only try to download the two files if remote files are needed.

Activity

  1. PaulWessel commented on Jul 6, 2020

    @PaulWessel
    Contributor

    Agreed. I will see where to implement a just-in-time solution.

  2. self-assigned this
    on Jul 6, 2020
  3. added
    feature request
    on Jul 6, 2020
  4. PaulWessel commented on Jul 6, 2020

    @PaulWessel
    Contributor

    Right now we call gmtlib_refresh_server during the start of every session (so for most uses, this means every time a module is run, regardless of what the module actually does or if remote files are even requested). I think this might work well:

    1. Move that call to the top of gmt_download_file_if_not_found. That is the function that determines if a requested file will need to be downloaded so we could do a just-in-time call to gmtlib_refresh_server. There may be several calls to gmt_download_file_if_not_found in that one session but it does not matter since once we do it once we set a bool flag so the function returns immediately if called again.
    2. We would also need to call it explicitly when running gmtget -D.

    Think this will cover all bases, @seisman?

  5. seisman commented on Jul 6, 2020

    @seisman
    MemberAuthor
    1. As I understand it, gmt_download_file_if_not_found function also deals with other URLs (not GMT remote files). Ideally, GMT should call gmtlib_refresh_server only if a remote file @xxx is requested, but I'm OK with what you proposed if it's easier to implement, since downloading any files (GMT remote files or other URLs) needs good internet connections.

    2. I'm not sure if my understanding of gmt_download_file_if_not_found is correct. If a file already exists locally, this function will do nothing, right? Does it mean that if I already have earth_relief_01d_p.grd locally, it will never refresh the server files, so the local earth_relief_01d_p.grd won't be updated?

  6. PaulWessel commented on Jul 6, 2020

    @PaulWessel
    Contributor

    As for point 1, we can do the refresh if the file starts with @ only. As for 2: The server file refresh is strictly a 24-hour clock thing. It does not care if you have a particular file or not since, as you point out, it may be obsolete. So we always refresh the server listing if > 24 hours old. This is of course separate from me still needing to implement a data tile/set refresh if older than the date in the listing....

  7. seisman commented on Jul 6, 2020

    @seisman
    MemberAuthor

    Then it sounds good to me.

    One more thing, can we add one more parameter (i.e., GMT_DATA_SERVER_FREQUENCY) so that users can control the frequency of the refreshing (24-hour by default). The reason is that some users may want to use the remote files but don't care about if the data are the latest or not.

  8. PaulWessel commented on Jul 6, 2020

    @PaulWessel
    Contributor

    Sure, that is a good idea, but perhaps a new 6.2 feature? Make an issue.

  9. PaulWessel commented on Jul 6, 2020

    @PaulWessel
    Contributor

    Sorry, taking abit longer that envision since quickly learning that the only place it needs to go is in gmt_init_module where we loop over the arguments and check if any start with @. We then do some registration check. Here is where we call the refresh, once. I can imaging we may have an arg like -Bxc@somefile so perhaps to be super-careful we should call refresh if any argument contains the letter @? At this point, we do not know what any argument means, so even though we may trigger on -B+t" My email is bob@devnull" it does not cause much damage?

  10. PaulWessel commented on Jul 6, 2020

    @PaulWessel
    Contributor

    If we dont do that here then we would need to also check in many other places. if refresh is not called then the dataset array is NULL and we may crash and burn.

  11. seisman commented on Jul 8, 2020

    @seisman
    MemberAuthor

    Implemented in #3616

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

feature request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions