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

strdate_to_datetime errors in time_manager_tests.jl #1145

Open
waywardpidgeon opened this issue Jan 21, 2025 · 4 comments
Open

strdate_to_datetime errors in time_manager_tests.jl #1145

waywardpidgeon opened this issue Jan 21, 2025 · 4 comments

Comments

@waywardpidgeon
Copy link

I ran the test sets in the ClimaCoupler.jl directory test using the environment of that name and the runtests.jl script, 22 Jan 2025 NZ time.

All succeeded apart from 4 errors all caused by the strdate_to_datetime method being apparently missing. Here is a typical stacktrace:

test strdate_to_datetime: Error During Test at C:\Users\kab\cc\clima\climacoupler.jl\test\time_manager_tests.jl:43
  Test threw exception
  Expression: TimeManager.strdate_to_datetime("00000101") == Dates.DateTime(0, 1, 1)
  UndefVarError: `strdate_to_datetime` not defined in `ClimaCoupler.TimeManager`
  Stacktrace:
   [1] getproperty(x::Module, f::Symbol)
     @ Base .\Base.jl:42
   [2] macro expansion
     @ C:\Users\kab\.julia\juliaup\julia-1.11.2+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Test\src\Test.jl:676 [inlined]
   [3] macro expansion
     @ C:\Users\kab\cc\clima\climacoupler.jl\test\time_manager_tests.jl:43 [inlined]
   [4] macro expansion
     @ C:\Users\kab\.julia\juliaup\julia-1.11.2+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Test\src\Test.jl:1704 [inlined]
   [5] top-level scope
     @ C:\Users\kab\cc\clima\climacoupler.jl\test\time_manager_tests.jl:42
Test Summary:            | Error  Total  Time
test strdate_to_datetime |     2      2  0.7s
ERROR: LoadError: Some tests did not pass: 0 passed, 0 failed, 2 errored, 0 broken.
in expression starting at C:\Users\kab\cc\clima\climacoupler.jl\test\time_manager_tests.jl:41

However the method strdate_to_datetime seems to be defined in src/TimeManager.jl:

strdate_to_datetime(strdate::String) =
    Dates.DateTime(parse(Int, strdate[1:4]), parse(Int, strdate[5:6]), parse(Int, strdate[7:8]))

Am I missing something here?
My environment is up-to-date: julia 1.11.2 and ClimaCoupler 0.1.2. I am running Windows 11 on an NVIDIA RTX A2000 6GB workstation.
The status for the test project package set is:

(test) pkg> st
Status `C:\Users\kab\CC\CliMA\ClimaCoupler.jl\test\Project.toml`
  [4c88cf16] Aqua v0.8.9
  [c7e460c6] ArgParse v1.2.0
⌃ [13f3f980] CairoMakie v0.12.18
⌅ [b2c96348] ClimaAtmos v0.27.9
  [3a4d1b5c] ClimaComms v0.6.5
  [d414da3d] ClimaCore v0.14.23
  [908f55d8] ClimaCoreMakie v0.4.6
  [d934ef94] ClimaCoreTempestRemap v0.3.18
  [4ade58fe] ClimaCoupler v0.1.2
  [5c42b081] ClimaParams v0.10.18
  [595c0a79] ClimaTimeSteppers v0.7.39
  [b3f4f4ca] ClimaUtilities v0.1.20
⌅ [ee78f7c6] Makie v0.21.18
  [85f8d34a] NCDatasets v0.14.6
  [08abe8d2] PrettyTables v2.4.0
  [1bc83da4] SafeTestsets v0.1.0
  [0bca4576] SciMLBase v2.71.3
  [90137ffa] StaticArrays v1.9.10
  [10745b16] Statistics v1.11.1
  [49b00bb7] SurfaceFluxes v0.12.0
  [b60c26fb] Thermodynamics v0.12.9
  [56f22d72] Artifacts v1.11.0
  [ade2ca70] Dates v1.11.0
  [37e2e46d] LinearAlgebra v1.11.0
  [44cfe95a] Pkg v1.11.0
  [de0858da] Printf v1.11.0
  [9a3f8284] Random v1.11.0
  [8dfed614] Test v1.11.0

Thanks.

@juliasloan25
Copy link
Member

This sounds like the same issue as CliMA/ClimaLand.jl#979! The strdate_to_datetime function was introduced after we released ClimaCoupler v0.1.2. You can either use ClimaCoupler v0.1.2 and run the tests from v0.1.2 (which don't use strdate_to_datetime since it wasn't in the repo at that time), or you can run the tests from current main and dev your local version of ClimaCoupler (these tests do use strdate_to_datetime, so you need to use the more recent version of ClimaCoupler you have checked out).

I would recommend the latter, which would look like this (from the ClimaCoupler/test/ directory):

julia --project
julia> ]
(test) pkg> dev ..

now when you run julia> ]st, you should see something like this:

Status `~/clima/ClimaCoupler.jl/test/Project.toml`
  [4c88cf16] Aqua v0.8.9
  [c7e460c6] ArgParse v1.2.0
⌃ [13f3f980] CairoMakie v0.12.18
⌅ [b2c96348] ClimaAtmos v0.27.9
  [3a4d1b5c] ClimaComms v0.6.5
⌃ [d414da3d] ClimaCore v0.14.22
  [908f55d8] ClimaCoreMakie v0.4.6
  [d934ef94] ClimaCoreTempestRemap v0.3.18
  [4ade58fe] ClimaCoupler v0.1.2 `..`
...

Note the .. next to ClimaCoupler, indicating that you're using your local version. Let me know if this works for you or if you have any other questions!

@waywardpidgeon
Copy link
Author

I did that replacing dev .. which gave an error by dev "full pathname of ClimaCoupler.jl in my file system" which did work as expected.

I then reran the tests and got as far as aqua (additional) which said, as you can see, that the package UUID for CUDA was missing. I added CUDA to the test project with no improvement. Recently I needed to install visual C++ redistributable on my Windows machines (see CUDA.jl installation instructions on github) to get CUDA to add - rather essential! Maybe there is something else I need to do?

I added [email protected] , I think a recent update, to Julia @v1.11, not the test project. No change in the result though.

Here is the result from the Windows 11 GPU processor running Julia 1.11.2:

PS C:\Users\kab\cc\clima\climacoupler.jl\test> julia --project runtests.jl
Aqua tests (additional): Test Failed at C:\Users\kab\.julia\packages\Aqua\bBjXC\src\stale_deps.jl:31
  Expression: isempty(stale_deps)
   Evaluated: isempty(Base.PkgId[Base.PkgId(Base.UUID("052768ef-5323-5732-b1bb-66c8b64840ba"), "CUDA")])

Stacktrace:
 [1] macro expansion
   @ C:\Users\kab\.julia\juliaup\julia-1.11.2+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Test\src\Test.jl:679 [inlined]
 [2] test_stale_deps(pkg::Base.PkgId; kwargs::@Kwargs{})
   @ Aqua C:\Users\kab\.julia\packages\Aqua\bBjXC\src\stale_deps.jl:31
 [3] test_stale_deps
   @ C:\Users\kab\.julia\packages\Aqua\bBjXC\src\stale_deps.jl:29 [inlined]
 [4] #test_stale_deps#38
   @ C:\Users\kab\.julia\packages\Aqua\bBjXC\src\stale_deps.jl:35 [inlined]
 [5] test_stale_deps(mod::Module)
   @ Aqua C:\Users\kab\.julia\packages\Aqua\bBjXC\src\stale_deps.jl:34
 [6] macro expansion
   @ C:\Users\kab\cc\clima\climacoupler.jl\test\aqua.jl:27 [inlined]
 [7] macro expansion
   @ C:\Users\kab\.julia\juliaup\julia-1.11.2+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Test\src\Test.jl:1704 [inlined]
 [8] top-level scope
   @ C:\Users\kab\cc\clima\climacoupler.jl\test\aqua.jl:26
Test Summary:                                                                              | Pass  Fail  Total  Time
Aqua tests                                                                                    |    9     1     10  8.7s
  Aqua tests (performance)                                                           |    2            2  0.4s
  Aqua tests (additional)                                                               |    7     1      8  6.6s
                                                                                                     |    1            1  0.0s 
                                                                                                     |    1            1  0.2s
                                                                                                     |    1            1  0.0s 
                                                                                                     |    1            1  0.0s
    Julia
    Base.PkgId(Base.UUID("4ade58fe-a8da-486c-bd89-46df092ec0c7"), "ClimaCoupler") deps   
    Base.PkgId(Base.UUID("4ade58fe-a8da-486c-bd89-46df092ec0c7"), "ClimaCoupler") extras  
    Base.PkgId(Base.UUID("4ade58fe-a8da-486c-bd89-46df092ec0c7"), "ClimaCoupler") weakdeps

ERROR: LoadError: Some tests did not pass: 9 passed, 1 failed, 0 errored, 0 broken.
in expression starting at C:\Users\kab\cc\clima\climacoupler.jl\test\runtests.jl:17

The status is

Status `C:\Users\kab\CC\CliMA\ClimaCoupler.jl\test\Project.toml`
  [4c88cf16] Aqua v0.8.9
  [c7e460c6] ArgParse v1.2.0
  [052768ef] CUDA v5.6.1
⌃ [13f3f980] CairoMakie v0.12.18
⌅ [b2c96348] ClimaAtmos v0.27.9
  [3a4d1b5c] ClimaComms v0.6.5
  [d414da3d] ClimaCore v0.14.23
  [908f55d8] ClimaCoreMakie v0.4.6
  [d934ef94] ClimaCoreTempestRemap v0.3.18
  [4ade58fe] ClimaCoupler v0.1.2 `c:\users\kab\cc\clima\ClimaCoupler.jl`
  [5c42b081] ClimaParams v0.10.18
  [595c0a79] ClimaTimeSteppers v0.7.39
⌃ [b3f4f4ca] ClimaUtilities v0.1.20
⌅ [ee78f7c6] Makie v0.21.18
  [85f8d34a] NCDatasets v0.14.6
  [08abe8d2] PrettyTables v2.4.0
  [1bc83da4] SafeTestsets v0.1.0
⌃ [0bca4576] SciMLBase v2.71.3
  [90137ffa] StaticArrays v1.9.10
  [10745b16] Statistics v1.11.1
  [49b00bb7] SurfaceFluxes v0.12.0
  [b60c26fb] Thermodynamics v0.12.9
  [56f22d72] Artifacts v1.11.0
  [ade2ca70] Dates v1.11.0
  [37e2e46d] LinearAlgebra v1.11.0
  [44cfe95a] Pkg v1.11.0
  [de0858da] Printf v1.11.0
  [9a3f8284] Random v1.11.0
  [8dfed614] Test v1.11.0
Info Packages marked with ⌃ and ⌅ have new versions available. Those with ⌃ may be upgradable, but those with ⌅ are restricted by compatibility constraints from upgrading. To see why use `status --outdated`

I'm beginning to understand what's going on here and will apply your advice later to the ClimaLand tests.
Many thanks for your patience - Kevin

@juliasloan25
Copy link
Member

Hi Kevin,

The Aqua.jl package runs a series of quality-assurance tests. The one you see failing is for stale dependencies (you can read more info in the Aqua.jl docs). This is because CUDA.jl is in the Project.toml, but not loaded (via using/import) in ClimaCoupler.jl. Could you try removing CUDA from the top-level and test environments to see if that helps?

@waywardpidgeon
Copy link
Author

waywardpidgeon commented Feb 4, 2025 via email

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

2 participants