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

[FEATURE]: extract linenum from file_regex for metrics #1726

Closed
2 tasks done
shahzebsiddiqui opened this issue Mar 7, 2024 · 0 comments · Fixed by #1751
Closed
2 tasks done

[FEATURE]: extract linenum from file_regex for metrics #1726

shahzebsiddiqui opened this issue Mar 7, 2024 · 0 comments · Fixed by #1751
Assignees

Comments

@shahzebsiddiqui
Copy link
Member

Please describe your feature

This feature is similar to #1725 but for file_regex where we want to extract a line number from file instead of stdout/stderr.

Here is an example of metrics declaration for file_regex that will simply write one line to file.

buildspecs:
  metric_file_regex:
    executor: generic.local.bash
    type: script
    description: capture result metric from file path
    run: echo "HPCG result is VALID with a GFLOP/s rating of=63.6515" > hpcg.txt
    tags: tutorials
    metrics:
      hpcg_rating_file:
        type: float
        file_regex:
          exp: '(\d+\.\d+)$'
          file: hpcg.txt
      hpcg_state_file:
        type: str
        file_regex:
          exp: '(VALID)'
          file: hpcg.txt

We can add a field linenum that will extract the line from file and apply regex so we can do the following

  metric_file_regex:
    executor: generic.local.bash
    type: script
    description: capture result metric from file path
    run: echo "HPCG result is VALID with a GFLOP/s rating of=63.6515" > hpcg.txt
    tags: tutorials
    metrics:
      hpcg_rating_file:
        type: float
        file_regex:
          exp: '(\d+\.\d+)$'
          linenum: 0
          file: hpcg.txt
      hpcg_state_file:
        type: str
        file_regex:
          exp: '(VALID)'
          file: hpcg.txt

If there is an index error due to invalid line number the metrics would be undefined. This would be the default behavior of any metric if regex is not found then it will be not defined.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants