Skip to content

Conversation

@migueldiascosta
Copy link
Member

Is something like this useful to anyone else?

(I'm calling it when --new-pr is run with -x, but of course, a new option could be created)

@boegel boegel added this to the 3.5.0 milestone Oct 23, 2017
@boegel
Copy link
Member

boegel commented Oct 23, 2017

Hmm, just gave this a quick try, doesn't seem to work for me, possibly because of the filename I'm using?

$ ls -l CP2K.eb
-rw-r--r--  1 kehoste  staff  1860 Oct 20 14:25 CP2K.eb
$ eb CP2K.eb --new-pr -x
== temporary log file in case of crash /tmp/eb-Ebn_P5/easybuild-_tfsfo.log
ERROR: Can't find path /private/tmp/eb-Ebn_P5/tmp0F3jsT/easybuilders/CP2K.eb

Also, I think it makes more sense to park this under a dedicated option like --preview-pr?

@migueldiascosta
Copy link
Member Author

  • it doesn't seem to be the filename, it does work for me if I use it.. strange

  • regarding the dedicated option, yes, I suppose so, if other people find it useful (and we get it to actually work :) )

@boegel
Copy link
Member

boegel commented Oct 23, 2017

== 2017-10-23 10:40:48,937 github.py:353 DEBUG Repo easybuild-easyconfigs at branch develop extracted into /private/tmp/eb-81EYLU/tmpDcQKjl/easybuilders/easybuild-easyconfigs-develop
== 2017-10-23 10:40:48,989 build_log.py:158 ERROR EasyBuild crashed with an error (at ?:124 in __init__): Can't find path /private/tmp/eb-81EYLU/tmpDcQKjl/easybuilders/CP2K.eb (at easybuild/framework/easyconfig/tools.py:375 in parse_easyconfigs)
ERROR: Can't find path /private/tmp/eb-81EYLU/tmpDcQKjl/easybuilders/CP2K.eb

Does this help at all?

I also see it or other easyconfigs that are named <name>.eb...

@migueldiascosta
Copy link
Member Author

it's looking for it under /private/tmp/... instead of /tmp/..., I guess I'll need to make sure it is copied to the correct path (where does the private come from in your environment?) or the correct path is used...

@boegel
Copy link
Member

boegel commented Oct 23, 2017

@migueldiascosta That's not the problem, /tmp and /private/tmp are the same thing...

$ ls -l /tmp
lrwxr-xr-x@ 1 root  wheel  11 Dec 26  2016 /tmp -> private/tmp

@boegel
Copy link
Member

boegel commented Oct 23, 2017

Hmm, doesn't seem to be related to filename at all:

$ eb --new-pr netCDF-Fortran-4.4.4-foss-2017b.eb netCDF-4.4.1.1-foss-2017b.eb HDF5-1.10.1-foss-2017b.eb -x
== temporary log file in case of crash /tmp/eb-tn6hu6/easybuild-KJzqnn.log
ERROR: Can't find path /private/tmp/eb-tn6hu6/tmp_AQfBZ/easybuilders/netCDF-Fortran-4.4.4-foss-2017b.eb

@migueldiascosta
Copy link
Member Author

ok, I can reproduce if I pass the eb filename without a path, I was always using one. I suppose I need to explicitly copy the file to the tmp folder.

Can you just check with an absolute path to make sure that's the problem?

@boegel boegel changed the title review-pr before submitting new-pr add support for --preview-pr Oct 24, 2017
else:
lines.extend(['', "(no related easyconfigs found for %s)\n" % os.path.basename(ec['spec'])])

return '\n'.join(lines)
Copy link
Member

Choose a reason for hiding this comment

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

@migueldiascosta This is working as expected now, but there's way too much copy-pasting going on here when comparing preview_pr with review_pr.
The only thing that differs is the list of files (pr_files) and a part of the log message.

Can we create a private method (_pr_diff_common or something like that) which accepts these two as additional arguments?

Copy link
Member Author

@migueldiascosta migueldiascosta Oct 24, 2017

Choose a reason for hiding this comment

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

@boegel definitely, will do

Copy link
Member

Choose a reason for hiding this comment

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

Current approach of enhancing the existing review_pr is way better 👍

if options.preview_pr:
print preview_pr(paths, colored=use_color(options.color))
cleanup(logfile, eb_tmpdir, testing, silent=True)
sys.exit(0)
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, can we avoid doing cleanup/exit here? How is this handled for --new-pr?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's because options.new_pr is in no_ec_opts, there's a cleanup later for those, I suppose options.preview_pr can also be added to them (although it's a bit counterintuitive that these don't require any easyconfigs to be specified?)

elif paths:
pr_files = [path[0] for path in paths]
else:
return "no easyconfigs or pr specified"
Copy link
Member

Choose a reason for hiding this comment

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

I would raise an error instead here, one of both mus be provided or something is wrong in the way review_pr is used...

Copy link
Member Author

Choose a reason for hiding this comment

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

done

if pr:
pr_files = [path for path in fetch_easyconfigs_from_pr(pr) if path.endswith('.eb')]
elif paths:
pr_files = [path[0] for path in paths]
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, shouldn't we pass the paths without the generated part down to review_pr instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

in main the paths from det_easyconfig_paths are transformed to these tuples and I used those, but I suppose I can call det_easyconfig_paths in main again, or store the original paths when it is called the first time

if pr:
_log.debug("File in PR#%s %s has these related easyconfigs: %s" % (pr, ec['spec'], files))
else:
_log.debug("File in new PR %s has these related easyconfigs: %s" % (ec['spec'], files))
Copy link
Member

Choose a reason for hiding this comment

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

Avoid repeating the whole thing:

if pr:
    pr_msg = "PR#%s" % pr
else:
    pr_msg = "new PR"
_log.debug("File in %s %s has these related easyconfigs: %s" % (pr_msg, ec['spec'], files))


# command line options that do not require any easyconfigs to be specified
no_ec_opts = [options.aggregate_regtest, options.new_pr, options.regtest, options.update_pr, search_query]
no_ec_opts = [options.aggregate_regtest, options.new_pr, options.preview_pr, options.regtest, options.update_pr, search_query]
Copy link
Member

Choose a reason for hiding this comment

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

line too long, needs wrapping...

Copy link
Member

Choose a reason for hiding this comment

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

Also, can't we use no_ec_opts or new_update_pr below, and avoid including options.new_pr, options.update_pr and options.preview_pr in no_ec_opts (since it's wrong, sematically)

Copy link
Member Author

Choose a reason for hiding this comment

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

actually, an update_pr could just add or remove a patch, without any easyconfig in the command line...?

Copy link
Member

Choose a reason for hiding this comment

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

OK, sure, but it doesn't make much sense for --new-pr and --preview-pr (although in theory you could also only use a patch file there)

forced = options.force or options.rebuild
dry_run_mode = options.dry_run or options.dry_run_short
new_update_pr = options.new_pr or options.update_pr
new_update_pr = options.new_pr or options.update_pr or options.preview_pr
Copy link
Member

Choose a reason for hiding this comment

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

maybe this should be renamed to new_update_preview_pr?

if options.new_pr:
if options.preview_pr:
print review_pr(paths=paths, colored=use_color(options.color))
elif options.new_pr:
Copy link
Member

Choose a reason for hiding this comment

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

keep these alphabetically sorted, so new_pr before preview_pr

pr_msg = "PR#%s" % pr
else:
pr_msg = "new PR"
_log.debug("File in %s %s has these related easyconfigs: %s" % (pr_msg, ec['spec'], files))
Copy link
Member

Choose a reason for hiding this comment

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

the _log.debug should not be under the else:, should be intended left one level so a log message is also emitted for --review-pr

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.

also missing: a dedicated test for the --preview-pr option, let me know if you need help with that


# cleanup and exit after dry run, searching easyconfigs or submitting regression test
if any(no_ec_opts + [options.check_conflicts, dry_run_mode, options.dump_env_script, options.inject_checksums]):
if any(no_ec_opts + [new_update_preview_pr, options.check_conflicts, dry_run_mode, options.dump_env_script, options.inject_checksums]):
Copy link
Member

Choose a reason for hiding this comment

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

now this line is too long, should be shortened somehow...

maybe like this:

stop_options = [options.check_conflicts, dry_run_mode, options.dump_env_script, options.inject_checksums]
if no_ec_opts or new_update_preview_pr or any(stop_options):
    cleanup(logfile, eb_tmpdir, testing)
    sys.exit(0)

@easybuilders easybuilders deleted a comment from boegelbot Oct 26, 2017
@boegel
Copy link
Member

boegel commented Oct 26, 2017

lgtm, just missing a dedicated test for --preview-pr, and an accompanying PR to update the docs?

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.

lgtm

@boegel
Copy link
Member

boegel commented Oct 30, 2017

@migueldiascosta Good to go, thanks!

Can you look into an update for the documentation too?

@boegel boegel merged commit b5562ac into easybuilders:develop Oct 30, 2017
wpoely86 added a commit that referenced this pull request Oct 31, 2017
fix bug that slipped in with #2331
@boegel
Copy link
Member

boegel commented Oct 31, 2017

documentation added in easybuilders/easybuild#388, thanks again @migueldiascosta!

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.

2 participants