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

Windows CI tests regularly failing due to issues with cached remote files for sph2grd #1602

Closed
maxrjones opened this issue Nov 1, 2021 · 1 comment · Fixed by #1615
Closed
Labels
maintenance Boring but important stuff for the core devs
Milestone

Comments

@maxrjones
Copy link
Member

maxrjones commented Nov 1, 2021

We seem to be semi-regularly getting failures on windows-latest - Python 3.7 / NumPy 1.18 with :
..\tests\test_sph2grd.py::test_sph2grd_outgrid FAILED [ 87%]
..\tests\test_sph2grd.py::test_sph2grd_no_outgrid FAILED [ 87%]
due to issues with the remote file.

Originally posted by @meghanrjones in #1242 (comment)

Full error message at https://github.com/GenericMappingTools/pygmt/runs/4099608763?check_suite_focus=true#step:11:578:

____________________________ test_sph2grd_outgrid _____________________________

    def test_sph2grd_outgrid():
        """
        Test sph2grd with a set outgrid.
        """
        with GMTTempFile(suffix=".nc") as tmpfile:
>           result = sph2grd(
                data="@EGM96_to_36.txt", outgrid=tmpfile.name, spacing=1, region="g"
            )

C:\Miniconda3\envs\pygmt\lib\site-packages\pygmt\tests\test_sph2grd.py:16: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
C:\Miniconda3\envs\pygmt\lib\site-packages\pygmt\helpers\decorators.py:586: in new_module
    return module_func(*args, **kwargs)
C:\Miniconda3\envs\pygmt\lib\site-packages\pygmt\helpers\decorators.py:726: in new_module
    return module_func(*args, **kwargs)
C:\Miniconda3\envs\pygmt\lib\site-packages\pygmt\src\sph2grd.py:75: in sph2grd
    lib.call_module("sph2grd", arg_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pygmt.clib.session.Session object at 0x000002E91CE65370>
Error:  [ERROR]: Cannot find file C:/Users/runneradmin/.gmt/cache/EGM96_to_36.txt
Error:  [ERROR]: File C:/Users/runneradmin/.gmt/cache/EGM96_to_36.txt not found
[Session pygmt-session (1719)]: Error returned from GMT API: GMT_FILE_NOT_FOUND (16)
___________________________ test_sph2grd_no_outgrid ___________________________

    def test_sph2grd_no_outgrid():
        """
        Test sph2grd with no set outgrid.
        """
>       temp_grid = sph2grd(data="@EGM96_to_36.txt", spacing=1, region="g")

C:\Miniconda3\envs\pygmt\lib\site-packages\pygmt\tests\test_sph2grd.py:27: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
C:\Miniconda3\envs\pygmt\lib\site-packages\pygmt\helpers\decorators.py:586: in new_module
    return module_func(*args, **kwargs)
C:\Miniconda3\envs\pygmt\lib\site-packages\pygmt\helpers\decorators.py:726: in new_module
    return module_func(*args, **kwargs)
C:\Miniconda3\envs\pygmt\lib\site-packages\pygmt\src\sph2grd.py:75: in sph2grd
    lib.call_module("sph2grd", arg_str)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pygmt.clib.session.Session object at 0x000002E91CEC3BB0>
module = 'sph2grd'
args = '@EGM96_to_36.txt -GC:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\pygmt-1jo39m30.nc -I1 -Rg'

    def call_module(self, module, args):
        """
        Call a GMT module with the given arguments.
    
        Makes a call to ``GMT_Call_Module`` from the C API using mode
        ``GMT_MODULE_CMD`` (arguments passed as a single string).
    
        Most interactions with the C API are done through this function.
    
        Parameters
        ----------
        module : str
            Module name (``'coast'``, ``'basemap'``, etc).
        args : str
            String with the command line arguments that will be passed to the
            module (for example, ``'-R0/5/0/10 -JM'``).
    
        Raises
        ------
        GMTCLibError
            If the returned status code of the function is non-zero.
        """
        c_call_module = self.get_libgmt_func(
            "GMT_Call_Module",
            argtypes=[ctp.c_void_p, ctp.c_char_p, ctp.c_int, ctp.c_void_p],
            restype=ctp.c_int,
        )
    
        mode = self["GMT_MODULE_CMD"]
        status = c_call_module(
            self.session_pointer, module.encode(), mode, args.encode()
        )
        if status != 0:
>           raise GMTCLibError(
                f"Module '{module}' failed with status code {status}:\n{self._error_message}"
            )
E           pygmt.exceptions.GMTCLibError: Module 'sph2grd' failed with status code 16:
Error:      sph2grd [ERROR]: Libcurl Error: Timeout was reached
Error:      sph2grd [ERROR]: File C:/Users/runneradmin/.gmt/cache/EGM96_to_36.txt was not found
Error:      sph2grd [ERROR]: Cannot find file C:/Users/runneradmin/.gmt/cache/EGM96_to_36.txt
Error:      sph2grd [ERROR]: File C:/Users/runneradmin/.gmt/cache/EGM96_to_36.txt not found

C:\Miniconda3\envs\pygmt\lib\site-packages\pygmt\clib\session.py:500: GMTCLibError
@weiji14 weiji14 added the maintenance Boring but important stuff for the core devs label Nov 3, 2021
@weiji14
Copy link
Member

weiji14 commented Nov 7, 2021

I found the problem, there's a missing @ sign and comma here:

"S90W180.earth_age_05m_g.nc" # Specific grid for 05m test
# Other cache files
"@EGM96_to_36.txt",

so two files weren't being downloaded:

gmtwhich [ERROR]: Cannot find file S90W180.earth_age_05m_g.nc@EGM96_to_36.txt
gmtwhich [ERROR]: File S90W180.earth_age_05m_g.nc@EGM96_to_36.txt not found!

This might explain why your earth_age_05m tests were failing #1471 (comment). I'll just tell @willschlitzer to add the comma at #1615 since he needs to re-run the cache anyway.

@weiji14 weiji14 linked a pull request Nov 8, 2021 that will close this issue
5 tasks
@seisman seisman added this to the 0.6.0 milestone Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants