Skip to content

Modify robot so that it only appends dependencies of tweaked easyconfigs#2090

Merged
boegel merged 12 commits intoeasybuilders:developfrom
ocaisa:improved-robot
Jan 26, 2017
Merged

Modify robot so that it only appends dependencies of tweaked easyconfigs#2090
boegel merged 12 commits intoeasybuilders:developfrom
ocaisa:improved-robot

Conversation

@ocaisa
Copy link
Copy Markdown
Member

@ocaisa ocaisa commented Jan 17, 2017

Modify the robot behaviour so that for dependencies it always check the existing easyconfigs first before resorting to using the ones that are generated by --try-toolchain

Fixes #1372

…n on the command line when using --try-toolchain
Comment thread easybuild/framework/easyconfig/tools.py Outdated
tweaked_ecs_paths = None
if tweaked_ecs:
tweaked_ecs_path = os.path.join(tmpdir, 'tweaked_easyconfigs')
tweaked_ecs_paths = [os.path.join(tmpdir, 'tweaked_easyconfigs'), os.path.join(tmpdir, 'tweaked_dep_easyconfigs')]
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is probably better off being a dictionary

@ocaisa ocaisa changed the title Modify robot so that it only appends dependencies of easyconfigs give… Modify robot so that it only appends dependencies of tweaked easyconfigs Jan 17, 2017
Comment thread easybuild/tools/robot.py Outdated
robot_path.insert(0, tweaked_ecs_paths['tweaked_ecs_path'])
# dependencies are always tweaked but we should only use them if there is no other option (so they come last)
robot_path.append(tweaked_ecs_paths['tweaked_ecs_deps_path'])
_log.info("Prepended list of robot search paths with %s and appended with %s: %s"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ocaisa style nitpicking: use , rather than %

log.info("...",
         arg1, arg2, arg3)

Comment thread easybuild/framework/easyconfig/tools.py Outdated
if tweaked_ecs:
tweaked_ecs_path = os.path.join(tmpdir, 'tweaked_easyconfigs')
tweaked_ecs_paths = {'tweaked_ecs_path': os.path.join(tmpdir, 'tweaked_easyconfigs'),
'tweaked_ecs_deps_path': os.path.join(tmpdir, 'tweaked_dep_easyconfigs')}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ocaisa using a dictionary here is overkill imho, I think a 2-tuple is more appropriate here

tweaked_ecs_paths = (os.path.join(tmpdir, 'tweaked_easyconfigs'), os.path.join(tmpdir, 'tweaked_dep_easyconfigs'))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I had originally but I felt the use later when constructing the robot path and dumping the tweaked easyconfigs wasn't very clear and could potentially lead to problems later. I don't mind changing it back but I thought this was a bit more explicit when it was being used.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using tweaked_ecs_paths[0]/target_dirs[0] and tweaked_ecs_paths[1]/target_dirs[1] is fairly clear to me ([0] for path to prepend, [1] for path to append)

Maybe you can also split it up like this to make it more clear:

tweaked_ecs_paths, tweaked_ecs_deps_path = target_dirs

That's even better, since it leaves no question how large the target_dirs tuple is, and it makes it clear it's not a list of directories as the name suggests.

The problem with a dictionary is that you could update it somewhere along the way to change the elements or add more etc., which is not the intention here. A tuple is immutable (although, admittedly, the list values in the tuple can be updated themselves).

@boegel
Copy link
Copy Markdown
Member

boegel commented Jan 18, 2017

@ocaisa Small remark. We'll need a (better) test for this too, let me know if you need any help with that.

@ocaisa
Copy link
Copy Markdown
Member Author

ocaisa commented Jan 18, 2017

I'm not sure how to design the test for this. I can use the bzip2 with GCC (that depends on gzip with GCC) and create another bzip2 and gzip easyconfig with iccifort...then I should be able to check that I'm using the tweaked bzip2 with the non-tweaked intel gzip (and that the tweaked version of gzip exists but is not used)...is that overkill?...is there a better way?

"""Tweak list of easyconfigs according to provided build specifications."""

if targetdirs is not None:
tweaked_ecs_path, tweaked_ecs_deps_path = targetdirs
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better initialise tweaked_ecs_path and tweaked_ecs_deps_path in case targetdirs is None, to avoid using undefined variables?

if tweaked_ecs:
tweaked_ecs_path = os.path.join(tmpdir, 'tweaked_easyconfigs')
tweaked_ecs_paths = (os.path.join(tmpdir, 'tweaked_easyconfigs'),
os.path.join(tmpdir, 'tweaked_dep_easyconfigs'))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this fits on a single line in the 120-chars limit?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, 2 characters too many

"""Tweak list of easyconfigs according to provided build specifications."""

if targetdirs is not None:
tweaked_ecs_path, tweaked_ecs_deps_path = targetdirs
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better initialise tweaked_ecs_path and tweaked_ecs_deps_path in case targetdirs is None, to avoid using undefined variables?

@boegel
Copy link
Copy Markdown
Member

boegel commented Jan 19, 2017

@ocaisa w.r.t. the test, how about doing a --try-toolchain-version on the existing OpenMPI test easyconfigs, which depend on hwloc for which test easyconfigs are also included?

@ocaisa
Copy link
Copy Markdown
Member Author

ocaisa commented Jan 26, 2017

@boegel The failing test is because it is failing to process the OpenMPI easyconfig on Travis. On my local machine this is not a problem...am I missing some kind of initialisation in the test?

@ocaisa
Copy link
Copy Markdown
Member Author

ocaisa commented Jan 26, 2017

@boegel Ok, tests are now passing, ready for a final review

Copy link
Copy Markdown
Member

@boegel boegel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just some minor code style remarks in the test, looks great!

Comment thread test/framework/robot.py Outdated

# Create directories to store the tweaked easyconfigs
eb_tmpdir = tempfile.gettempdir()
tweaked_ecs_paths, pr_path = alt_easyconfig_paths(eb_tmpdir, tweaked_ecs=True)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ocaisa please use self.test_prefix instead of eb_tmpdir, which is a sandbox created for every test that is also cleaned up automagically

Comment thread test/framework/robot.py Outdated

# Parse the easyconfig that we want to tweak
untweaked_openmpi = os.path.join(test_easyconfigs, 'o', 'OpenMPI', 'OpenMPI-1.6.4-GCC-4.6.4.eb')
self.assertTrue(os.path.isfile(untweaked_openmpi))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, this is overkill, you'd get a failure anyway from parse_easyconfigs?

Comment thread test/framework/robot.py Outdated

# Check that all expected tweaked easyconfigs exists
tweaked_openmpi = os.path.join(tweaked_ecs_paths[0],'OpenMPI-1.6.4-GCC-4.7.2.eb')
tweaked_hwloc = os.path.join(tweaked_ecs_paths[1],'hwloc-1.6.2-GCC-4.7.2.eb')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style nitpicking: space after ,

@boegel
Copy link
Copy Markdown
Member

boegel commented Jan 26, 2017

Going in, thanks @ocaisa!

@boegel boegel merged commit 7d79e5a into easybuilders:develop Jan 26, 2017
boegel added a commit to boegel/easybuild-framework that referenced this pull request Feb 3, 2017
@ocaisa ocaisa deleted the improved-robot branch September 26, 2018 11:22
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

Successfully merging this pull request may close these issues.

2 participants