buildtesters/buildtest

[FEATURE]: add support for multiple profiles during buildtest build

Closed this issue · 5 comments

Please describe your feature

We should introduce the concept of profiles which will mimic the options that can be encapsulated into a single name to avoid having users to type several options. This will address this issue where we have multiple runs

buildtest bd -b /tmp/foo.yml -b tutorials
buildtest bd -b  /tmp/containers/ --rebuild=2 -x /tmp/containers/bar.yml
buildtest bd -t python 
buildtest bd -t containers -m gcc/9.3.0 --module-purge --report /tmp/containers.json

Instead of having to run the above commands we can add profiles that can be defined in configuration file as follows

profiles:
  python:
    tags: [python]
  containers:
    tags: [containers]
    module: [gcc/9.3.0]
    module-purge: True
  foo:
    buildspecs: [/tmp/foo.yml , tutorials ]
  bar:
    buildspecs: [ /tmp/containers/ ]
    rebuild: 2
    exclude: [ /tmp/containers/bar.yml ]
    report: /tmp/containers.json

With this being said we can simply run the commands from the profiles where each profile sub-key must be a unique name and must be alphabets only so the following statements are equivalent

The two commands below will behave the same way.

buildtest bd -b /tmp/foo.yml -b tutorials
buildtest bd --prof=foo

If other options are specified when --prof is used they will be simply ignored.

Suggest potential solution

No response

Additional Information

No response

Post question in Slack

  • I agree that I posted my question in slack before creating this issue

Is there an existing issue

  • I confirm there is no existing issue for this issue

@prathmesh4321 @Xiangs18 what do you guys think about this feature?

some additional ideas i thought about if we have this.

We can have something like buildtest build -b foo.yml -t python --save-prof=python which will record the command options and save them as profile name python and write this to configuration file without actually running the test. Basically it will auto-generate the configuration file.

Another feature can be to list all the profiles this could be a new subcommand like

# list profiles as flat listing
buildtest cg prof

# list profiles as yaml
buildtest cg profiles --yaml
# list profile as json
buildtest cg profiles --json

# just show in YAML and no other option
buildtest cg profiles --detailed

@prathmesh4321 @Xiangs18 what do you guys think about this feature?

Hi, @shahzebsiddiqui this feature looks really helpful and I think we should implement this. I have one concern though. The user would have to remember the names of the profiles and might often forget the names and in that case would have to scan through the complete list of profiles.

So I think we can also have something like buildtest cg --prof=python --json which will display an individual profile from the available list of profiles.

Additionally, we can have a command to filter the profiles that contain a particular option. So for example in the below configuration:

profiles:
  python:
    tags: [python]
  containers:
    tags: [containers]
    module: [gcc/9.3.0]
    module-purge: True
  foo:
    buildspecs: [/tmp/foo.yml , tutorials ]
    exclude: [ /tmp/containers/xyz.yml ]
  bar:
    buildspecs: [ /tmp/containers/ ]
    rebuild: 2
    exclude: [ /tmp/containers/bar.yml ]
    report: /tmp/containers.json

if we do something like buildtest cg profiles --filter exclude it should list the following profiles that contain the exclude option. So it becomes easier to choose from the filtered profiles even if the user doesn't remember the individual profile names.

foo:
   buildspecs: [/tmp/foo.yml , tutorials ]
   exclude: [ /tmp/containers/xyz.yml ]
bar:
   buildspecs: [ /tmp/containers/ ]
   rebuild: 2
   exclude: [ /tmp/containers/bar.yml ]
   report: /tmp/containers.json

i did post an issue #1490 pertaining to listing profiles. As per --filter i am not entirely sure if that will be useful and it may get a bit complicated to setup. I think that simply seeing the profile via command line is very helpful so if one doesn't know the attributes they can get them as pose to running buildtest cg profiles --filter exclude and not get what they want since chances are if output returns nothing its not useful.

@prathmesh4321 One command that i think will be useful is the ability to remove profiles since --save-profile will add them, the only way to remove them right now is manually do them so i do propose a builtin command such as buildtest cg profile remove <profile> to remove profiles and update configuration file. I added an issue #1491