Errors when ReFrame root directory is not first path in `sys.path`
See original GitHub issueHello,
The context here is when I use ReFrame CI integration capabilities, I am getting errors in the dependent jobs. When we use --restore-session
flag for dependent job, ReFrame is detecting modules from filenames here.
I am not sure of the rabbit hole details of why it is being done, but the issue I have noticed is that on that stated line, we implicitly assume sys.path[0]
if ReFrame root directory. If it is not, ReFrame will have problems finding the modules. For example, in this failed CI pipeline, I printed the sys.path
and we can see that ReFrame root directory is not the first path.
This is the directory structure of my repository:
.
βββ apps
βββ config
βββ docs
βββ helloworld
βββ modules
βββ output
βββ perflogs
βββ reframe
βββ spack
βββ topologies
And I usually launch tests from root of the repo using:
reframe/bin/reframe -C <config> -c <test> -r
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Module import error even though sys.path shows the directory?
I am having trouble installing a package through its directory (not possible to install through pip, only folder available) on my mac.
Read more >Tutorial 6: Tips and Tricks β ReFrame 3.12.0 documentation
When a test fails, ReFrame will keep the test output in the stage directory after its execution, which means that one can load...
Read more >The initialization of the sys.path module search path β Python ...
A module search path is initialized when Python starts. This module search path may be accessed at sys.path. The first entry in the...
Read more >Debugging with sys.path / ImportError issues
When a module is actually a directory, the things you can import from it are: any other modules that are inside the directory...
Read more >Understanding Python imports, __init__.py and pythonpath
The python interpreter tries to look for the directory containing the module we are trying to import in sys.path .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just to give more info on the issue. I guess the issue comes from here -> https://gitlab.com/ska-telescope/sdp/ska-sdp-benchmark-tests/-/blob/93048cf173e1c5c0b3cafbbdc11c309297c1d5ad/apps/level1/imaging-iotest/reframe_iotest.py#L63 . I do not remember why, back then I was appending the current working directory path to
sys.path
as pointed out in the line. That is why/builds/ska-telescope/sdp/ska-sdp-benchmark-tests
is on the front insys.path
.And why it failed only in CI? Well, I guess
import_module_from_file
function is called only when invoking ReFrame with--report-file
and/or--restore-session
flags, if I remember well. In the child pipeline CI jobs, ReFrame is invoked with those flags -> https://gitlab.com/ska-telescope/sdp/ska-sdp-benchmark-tests/-/jobs/1512502926#L46 . I never used these flags when running tests on HPC systems and that is why I did not face this issue even when ReFrame is not on front insys.path
.I hope that helps!
Hello @rsarm, thanks for coming back to the issue. Actually, the pipeline failed. Let me try to put things more constructively:
sys.path
. However, I printed thesys.path
on one of the failed pipelines -> https://gitlab.com/ska-telescope/sdp/ska-sdp-benchmark-tests/-/jobs/1512352442#L91 and we can see here that ReFrame is not the first one insys.path
. This job is the one that generates child pipeline and it always runs successfully. It is the next job, ie the one that executes the child pipeline, that fails. Please have a look at it -> https://gitlab.com/ska-telescope/sdp/ska-sdp-benchmark-tests/-/jobs/1512502926 ./builds/ska-telescope/sdp/ska-sdp-benchmark-tests
path popped up in there. I have noticed that it happened only in the CI jobs. Maybe it is something GitLab CI specific? I never faced this issue when running the tests on HPC platforms.sys.path
which can fail ReFrame. That is why I suggested to check thesys.path
inimport_module_from_file
function to make it more resilient.Is it more clear now? If not, we can have a quick chat about the issue. Cheers