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
Make FDTD_Solutions easyblock do the install with copytree instead of rpm rebuild #1307
Make FDTD_Solutions easyblock do the install with copytree instead of rpm rebuild #1307
Conversation
…rpm rebuild. rpm installation is not kosher on Debian based systems.
FWIW, I have used this easyblock successfully to install FDTD Solutions on Compute Canada servers. |
return guesses | ||
raise EasyBuildError("Failed to copy %s to %s: %s", | ||
os.path.join(self.cfg['start_dir'], 'opt', 'lumerical', 'fdtd'), | ||
self.installdir, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains tabs
continuation line missing indentation or outdented
}) | ||
return guesses | ||
raise EasyBuildError("Failed to copy %s to %s: %s", | ||
os.path.join(self.cfg['start_dir'], 'opt', 'lumerical', 'fdtd'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains tabs
indentation contains mixed spaces and tabs
continuation line under-indented for visual indent
# shutil.copytree doesn't allow the target directory to exist already | ||
rmtree2(self.installdir) | ||
shutil.copytree(os.path.join(self.cfg['start_dir'], 'opt', 'lumerical', 'fdtd'), | ||
self.installdir, symlinks=self.cfg['keepsymlinks']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line over-indented for visual indent
shutil.copy2(rebuilt_rpms[0], rpms[0]) | ||
# shutil.copytree doesn't allow the target directory to exist already | ||
rmtree2(self.installdir) | ||
shutil.copytree(os.path.join(self.cfg['start_dir'], 'opt', 'lumerical', 'fdtd'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akesandgren This should be updated to use copy_dir
from filetools
(no need for the try
/except
anymore then)
Also, please define a variable with the path you're copying, since you're using it in two places (here + the error message)
ftdt_dir = os.path.join(self.cfg['start_dir'], 'opt', 'lumerical', 'fdtd')
copy_dir(ftdt_dir, self.installdir, symlinks=self.cfg['keepsymlinks'])
|
||
def sanity_check_step(self): | ||
"""Custom sanity check for FDTD Solutions.""" | ||
custom_paths = { | ||
'files': [], | ||
'dirs': ['opt/lumerical/fdtd/bin', 'opt/lumerical/fdtd/lib'], | ||
'dirs': ['bin', 'lib'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akesandgren It's probably worth checking for some specific files at least?
Add some actual files to sanity_check and use a dir not checked by files.
return guesses | ||
"""Install FDTD Solutions using copy tree.""" | ||
fdtd_dir = os.path.join(self.cfg['start_dir'], 'opt', 'lumerical', 'fdtd') | ||
copy_dir(ftdt_dir, self.installdir, symlinks=self.cfg['keepsymlinks']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undefined name 'copy_dir'
undefined name 'ftdt_dir'
@@ -33,64 +33,39 @@ | |||
from easybuild.easyblocks.generic.packedbinary import PackedBinary | |||
from easybuild.easyblocks.generic.rpm import rebuild_rpm | |||
from easybuild.tools.build_log import EasyBuildError | |||
from easybuild.tools.run import run_cmd_qa | |||
from easybuild.tools.filetools import rmtree2 | |||
from easybuild.tools.run import run_cmd, run_cmd_qa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'easybuild.tools.run.run_cmd_qa' imported but unused
@@ -33,64 +33,39 @@ | |||
from easybuild.easyblocks.generic.packedbinary import PackedBinary | |||
from easybuild.easyblocks.generic.rpm import rebuild_rpm | |||
from easybuild.tools.build_log import EasyBuildError | |||
from easybuild.tools.run import run_cmd_qa | |||
from easybuild.tools.filetools import rmtree2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'easybuild.tools.filetools.rmtree2' imported but unused
return guesses | ||
"""Install FDTD Solutions using copy tree.""" | ||
fdtd_dir = os.path.join(self.cfg['start_dir'], 'opt', 'lumerical', 'fdtd') | ||
copy_dir(fdtd_dir, self.installdir, symlinks=self.cfg['keepsymlinks']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akesandgren Installation fails now because the install directory is pre-created, and copy_dir
doesn't like that.
You'll need to either call remove_dir(self.installdir)s
first, or override the make_installdir
method to make it a no-op (just log a message like "Not pre-creating installation directory %s" % self.installdir
instead)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like that then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I overlooked that make_installdir
is also responsible for removing an existing installation directory in case of a forced reinstall, so you should (also) set self.cfg['dontcreateinstalldir'] = True
before calling the parent:
def make_installdir(self):
"""Override installdir creation"""
self.log.warning("Not pre-creating installation directory %s" % self.installdir)
self.cfg['dontcreateinstalldir'] = True
super(EB_EB_FDTD_underscore_Solutions, self).make_installdir()
…stalldir=True Otherwise a forced reinstall won't remove the existing installdir.
"""Override installdir creation""" | ||
self.log.warning("Not pre-creating installation directory %s" % self.installdir) | ||
self.cfg['dontcreateinstalldir'] = True | ||
super(EB_EB_FDTD_underscore_Solutions, self).make_installdir() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
undefined name 'EB_EB_FDTD_underscore_Solutions'
'files': [], | ||
'dirs': ['opt/lumerical/fdtd/bin', 'opt/lumerical/fdtd/lib'], | ||
'files': ['bin/fdtd-solutions', 'lib/fdtd-engine-mpichp4_libFNP.so'], | ||
'dirs': ['api'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akesandgren There no api
installed for the existing FDTD_Solutions
easyconfigs (8.6.2
and 8.11.337
).
And for 8.6.2
, there's no lib/fdtd-engine-mpichp4_libFNP.so
either (not even close).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gah.... I only have 8.16.982 to look at...
Any suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about just checking for bin/fdtd-solutions
and a non-empty lib
dir?
That's still a little bit stricter than what was there (which was basically just checking for bin
& lib
)...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checking for a non-empty lib? what do you mean? I can check for an existing lib dir like it was done before, but how can i check for a non-empty one without checking for a specific file?
Or did you just mean an existing lib dir?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct me if I'm wrong, but 'dirs': ['lib']
already fails if the lib
directory is empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does? Didn't really know that, but if that's the case it's good enough for me :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In easyblock.py
:
2140 path_keys_and_check = {
2141 # files must exist and not be a directory
2142 'files': ('file', lambda fp: os.path.exists(fp) and not os.path.isdir(fp)),
2143 # directories must exist and be non-empty
2144 'dirs': ("(non-empty) directory", lambda dp: os.path.isdir(dp) and os.listdir(dp)),
2145 }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly, the dirs
entries need to exist & be non-empty. Checking for an empty dir is kind of useless. ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, now still works with the existing easyconfigs FDTD_Solutions-8.11.337.eb
and FDTD_Solutions-8.6.2.eb
rpm installation is not kosher on Debian based systems.