-
Notifications
You must be signed in to change notification settings - Fork 4
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
+exclude
functionality!
#54
base: master
Are you sure you want to change the base?
Conversation
This looks useful and the code is clean. Nice job! I'm willing to merge this in if you will also update the README to document how it works. I think a short description plus a worked example would suffice. The example should use real-sounding variable names, so it's clear intuitively what the use case is. |
Regarding how to run tests, currently it's But I'm noticing that the |
@taodav I don't like messing with the constants in this PR. We should discuss where the default .onager directory goes in a separate PR. |
My bad! Forgot this PR was open and implemented it for my own use. |
Np. But let's finish it and merge at some point! :) |
Please remove your .idea folder |
Just caught it, removed! |
Awesome. Can you provide a worked example in the readme as well? |
Done! Also added titles for the types of arguments and options. |
print(f"Prelaunched {len(jobs)} jobs for {args.jobname}.") | ||
|
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.
Lol stop sneaking in other functionality! Does this work correctly with the +quiet
argument?
def filter_cmd_prefix(exclude_variables, cmd_prefix_list, VAR_SEP=' '): | ||
exclude_arg_keys = [] | ||
for key, variable in exclude_variables.items(): | ||
curr_key_strs = [] | ||
for v in variable: | ||
curr_key_strs.append(key + VAR_SEP + v) | ||
|
||
exclude_arg_keys.append(curr_key_strs) | ||
|
||
filtered_prefix_list = [] | ||
for cmd_prefix in cmd_prefix_list: | ||
all_keys_match = True if exclude_arg_keys else False | ||
for curr_key_strs in exclude_arg_keys: | ||
all_keys_match &= any(key_str in cmd_prefix for key_str in curr_key_strs) | ||
|
||
if not all_keys_match: | ||
break | ||
|
||
if not all_keys_match: | ||
filtered_prefix_list.append(cmd_prefix) | ||
|
||
return filtered_prefix_list |
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.
Comments please :)
I'm confused about all_keys_match
, because it seems like exclude_arg_keys
could be truthy even if you only have one exclude variable.
As mentioned in #53, this PR is for the
+exclude
functionality.+exclude
removes a subset of the runs generated by+args
, by removing all runs that include arguments with the cross product of all+exclude
hyperparams. So for example:prelaunch +command test +jobname test +arg --test1 1 2 3 +arg --test2 4 5 6 +exclude --test1 1 2 +exclude --test2 5
Should exclude all jobs with arguments
--test1 1 --test2 5
--test1 2 --test2 5
I've also written a test according to this example, but am unsure of how to run the test...