Skip to content

Commit

Permalink
Convert --session-extras to an append-type option
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarak committed Oct 14, 2024
1 parent eafcdeb commit 30b22d5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions docs/manpage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,8 @@ Miscellaneous options
The key/value data is specified as a comma-separated list of `key=value` pairs.
When listing stored sessions with the :option:`--list-stored-sessions` option, any associated custom metadata will be presented.

This option can be specified multiple times, in which case the data from all options will be combined in a single list of key/value data.

.. versionadded:: 4.7

.. option:: --session-filter EXPR
Expand Down
9 changes: 5 additions & 4 deletions reframe/frontend/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ def main():
'(default: "now:now/last:+job_nodelist/+result")')
)
reporting_options.add_argument(
'--session-extras', action='store', metavar='KV_DATA',
'--session-extras', action='append', metavar='KV_DATA',
help='Annotate session with custom key/value data'
)
reporting_options.add_argument(
Expand Down Expand Up @@ -1601,9 +1601,10 @@ def module_unuse(*paths):
if options.session_extras:
# Update report's extras
extras = {}
for arg in options.session_extras.split(','):
k, v = arg.split('=', maxsplit=1)
extras[k] = v
for sess in options.session_extras:
for arg in sess.split(','):
k, v = arg.split('=', maxsplit=1)
extras[k] = v

report.update_extras(extras)

Expand Down
1 change: 1 addition & 0 deletions unittests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,7 @@ def test_session_annotations(run_reframe):
checkpath=['unittests/resources/checks/frontend_checks.py'],
action='-r',
more_options=['--session-extras', 'key1=val1,key2=val2',
'--session-extras', 'key3=val3',
'-n', '^PerformanceFailureCheck']
), exitcode=1)

Expand Down

0 comments on commit 30b22d5

Please sign in to comment.