Closed joakimkjellsson closed 3 years ago
Dear @joakimkjellsson,
I found the error. This is actually not a bug in esm_tools
but something to consider due to the infinite linking in UNIX.
First of all, it looks to me like you are not using the latest version of esm_tools by
esm_versions upgrade
Consider this command: ln -s endless_link endless_link
This is a perfect UNIX command although it is useless. We just created a symbolic link (soft link) that points to itself. Dropping -s would not work here (hard link). When os.path.realpath
tries to resolve the link, it will get into the infinite loop.
We just made a quick discussion with @mandresm and made a merge to the system. Therefore, when you upgrade your esm_tools you should be good to go.
Cheers, Deniz
Hi @denizural Thanks for the help! I realised that my attempt to continue the run had created a bunch of broken links etc, so it took a while to fix. But I managed to get there.
However, I did have to comment out the two lines with "config" in your fix. Otherwise I got an error that config does not exist.
def resolve_symlinks(file_source):
if os.path.islink(file_source):
points_to = os.path.realpath(file_source)
# deniz: check if file links to itself. In UNIX
# ln -s endless_link endless_link is a valid command
if os.path.abspath(file_source) == points_to:
#if config["general"]["verbose"]: ## commented out this
# print(f"file {file_source} links to itself")
return file_source
# recursively find the file that the link is pointing to
return resolve_symlinks(points_to)
else:
return(file_source)
Cheers Joakim
Hi @joakimkjellsson,
I am glad that it worked. config["general"]["verbose"]
only works in the most recent version. But commenting out is of course a quick solution. Can you now run your model without any problems?
Cheers, Deniz
Good afternoon all
I'm trying to continue a run that I started last year using ESM-Tools release 4. Since then I've moved to release 5, but now struggling with continuing the run. If I'm reading the error messages correctly, the problem is with the linking of restart files. The old release 4 did not link, but made copies of restart files.
Here's my full output:
Does anyone know how to solve this problem? It seems to get stuck in an infinite loop of links where "resolve_symlinks" returns a link and not a real file. Has anyone had a similar problem before?
Cheers Joakim