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

add support for using 'sources' and 'git_config' for extensions in 'exts_list' #3294

Merged
merged 22 commits into from
Jun 12, 2020

Conversation

kelseymh
Copy link
Contributor

@kelseymh kelseymh commented Apr 22, 2020

Modify fetch_extension_sources() so that when a source dictionary is included in an exts_list entry, it looks for git_config, and passes the latter through to obtain_file(). This allows us to pull extensions from Git the same way we pull regular sources, including creating a local tar-ball on the fly.

I plan to make this a "draft" (WIP) PR initially, because I haven't been able to explicitly test my code changes.

edit (@boegel): fixes #3251

@kelseymh kelseymh marked this pull request as draft April 22, 2020 04:46
@kelseymh
Copy link
Contributor Author

I've successfully tested this feature with one of our internal Git packages. In my EasyConfig file, I have an extensions block:

exts_defaultclass = 'PythonPackage'
exts_list = [
    ('pyCAP', 'master', {
        'filename': 'pyCAP-master.tar.gz',
        'git_config': {
            'url': local_git + '/Analysis',
            'repo_name': 'pyCAP',
            'tag': 'master',
        }
    }),
]

When I run with the production eb (EasyBuild/2020a-sprint), I get the expected failure:

== fetching files...
== FAILED: Installation ended unsuccessfully (build directory: /scratch/group/mi
tchcomp/eb/tmp/build/cdmsPyGlobal/0.5/system-system-Python-3.6.6test):
build failed (first 300 chars): Couldn't find file pyCAP-master.tar.gz anywhere,
and downloading it didn't work either... Paths attempted (in order): /scratch/gr
oup/mitchcomp/eb/eb-files/c/cdmsPyGlobal/extensions/pyCAP-master.tar.gz, /scratc
h/group/mitchcomp/eb/eb-files/c/cdmsPyGlobal/packages/pyCAP-master.tar.gz, /scra
tch/group/m (took 0 sec)

but when I run with my personal checkout, it succeeds:

== fetching files...
== creating build dir, resetting environment...
[...]
== taking care of extensions...
== installing extension pyCAP master (1/1)...
[...]

Is there documentation for how to create a new unit test? I'd love to exercise this in some way as part of the pull request.

@kelseymh
Copy link
Contributor Author

@boegel Suggested that a unit test could be added to either the easyblock.py or toy_build.py tests.

I think I can do this, but neither one appears to actually perform a download of sources. What I would want to test is a dictionary entry like

exts_list = [('toy', '1.0', {
    'filename':'toy-build.tar.gz', 
    'git_config': {
        'url':'https://github.com/something-something',
        'repo_name':'toy', 'tag':'1.0',
    }
})]

and see that either the download actually occurs (ideal) or at least that the contents of 'git_config' is seen and is validated.

@kelseymh
Copy link
Contributor Author

kelseymh commented Apr 23, 2020

I don't think I need to actually " see that ... the download actually occurs (ideal)." The filetools.py tests already include test_get_source_tarball_from_git(). That exercises both the different components of git_config as well as the downloading procedure.

For this situation, I just need to test whether having a 'git_config' dictionary in exts_list does not generate an error. This should be easier for me to figure out how to implement.

Update. Well, that didn't go so well. The test failed (which I expected), but then spewed hundreds of lines of DEBUG output. I'm sure an explanation for the failure is in there somewhere...

@kelseymh
Copy link
Contributor Author

I just noticed that test_obtain_file() in the easyblock.py test does not exercise the git_config option. Should I try to add that as a unit test as well?

@kelseymh kelseymh marked this pull request as ready for review April 25, 2020 20:53
@kelseymh kelseymh changed the title Add 'git_config' support within 'exts_list' (WIP) Add 'git_config' support within 'exts_list' Apr 27, 2020
@easybuilders easybuilders deleted a comment from boegelbot May 1, 2020
@easybuilders easybuilders deleted a comment from boegelbot May 1, 2020
@easybuilders easybuilders deleted a comment from boegelbot May 1, 2020
@boegel boegel added this to the next release (4.2.1?) milestone May 1, 2020
@akesandgren
Copy link
Contributor

@boegel @kelseymh Shouldn't the format for this be

exts_list = [
  ('pyCAP', 'master', {
    'sources': [{
      'filename':...,
      'git_config'
    }],
  }),
]

To make it clear that it's the source specification, and make it behave like non-ext-list sources, allowing multiple sources files...

@kelseymh
Copy link
Contributor Author

kelseymh commented May 1, 2020

@akesandgren That's a good question! The allowed content of exts_list is undocumented, so I constructed that example block by trial and error.

In the code of this PR, I didn't want to try to change how exts_list parsed the extra_options dictionary, just added extraction of a git_config element.

The EasyConfigs which make use of 'sources' in a dictionary all seem to have it either at the top level or in default_component_specs (see, e.g., SpliceMap).

My write up of exts_list behaviour (see Framework PR #617 follows this searc of existing examples. If putting a whole 'sources': dictionary into extra_options does work, then I should update that attempt at documentation accordingly.

Copy link
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.

@kelseymh Great job on figuring this out, I'm sure that took a fair amount of effort...

An enhanced test for obtain_file to cover the use of git_config makes sense too, but that can also be tackled in a separate PR I think, up to you...

I agree with @akesandgren's remark w.r.t. git_config vs sources (only read his comment after I wrote up mine, so I'll leave it in place).

test/framework/toy_build.py Outdated Show resolved Hide resolved
test/framework/toy_build.py Outdated Show resolved Hide resolved
@kelseymh
Copy link
Contributor Author

kelseymh commented May 3, 2020

@boegel wrote:

An enhanced test for obtain_file to cover the use of git_config makes sense too, but that can also be tackled in a separate PR I think, up to you...

No need. I got most of the way through writing it, and discovered that test/framework/filetools.py already contains test_test_get_source_tarball_from_git(). I've closed the issue (#3322) I created for this.

@boegel boegel added this to the release after 4.2.1 (4.2.2?) milestone May 19, 2020
@easybuilders easybuilders deleted a comment from boegelbot May 19, 2020
@easybuilders easybuilders deleted a comment from boegelbot May 19, 2020
@kelseymh kelseymh changed the title Add 'git_config' support within 'exts_list' (WIP) Add 'git_config' support within 'exts_list' May 20, 2020
@kelseymh kelseymh marked this pull request as ready for review May 20, 2020 15:17
easybuild/framework/easyblock.py Outdated Show resolved Hide resolved
easybuild/framework/easyblock.py Outdated Show resolved Hide resolved
easybuild/framework/easyblock.py Outdated Show resolved Hide resolved
easybuild/framework/easyblock.py Outdated Show resolved Hide resolved
easybuild/framework/easyblock.py Outdated Show resolved Hide resolved
easybuild/framework/easyblock.py Outdated Show resolved Hide resolved
allow single-element list as 'sources' value in exts_list
@boegel
Copy link
Member

boegel commented Jun 11, 2020

Close & re-open to try and get Travis to wake up... You're running on fumes here Travis, seriously...

@boegel boegel closed this Jun 11, 2020
@boegel boegel reopened this Jun 11, 2020
@boegel boegel merged commit 4208302 into easybuilders:develop Jun 12, 2020
@kelseymh kelseymh deleted the 3290_git_in_exts-list branch June 12, 2020 14:50
@boegel boegel changed the title Add 'git_config' support within 'exts_list' add support for using 'sources' and 'git_config' for extensions in 'exts_list' Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Installing extensions from git repository
3 participants