torchx icon indicating copy to clipboard operation
torchx copied to clipboard

Introduce StructuredRunOpt for more complex runopts

Open AbishekS opened this issue 2 months ago • 2 comments

Summary: StructuredRunOpt can be used to create new complex runopts

This can be used as for example:

    dataclass
    class UlimitTest(StructuredRunOpt):
        name: str
        hard: int
        soft: int

        def template(self) -> str:
            return "{name},{soft},{hard}"

This comes with

  1. template() that helps the from_repr() use that template to map to the fields with types
  2. eq to check equality between two

Differential Revision: D85159071

AbishekS avatar Oct 21 '25 20:10 AbishekS

@AbishekS has exported this pull request. If you are a Meta employee, you can view the originating Diff in D85159071.

meta-codesync[bot] avatar Oct 21 '25 20:10 meta-codesync[bot]

Codecov Report

:x: Patch coverage is 88.88889% with 3 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 91.61%. Comparing base (dd683f4) to head (9a6da96).

Files with missing lines Patch % Lines
torchx/specs/api.py 88.88% 3 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1154      +/-   ##
==========================================
- Coverage   91.63%   91.61%   -0.02%     
==========================================
  Files          84       84              
  Lines        6595     6619      +24     
==========================================
+ Hits         6043     6064      +21     
- Misses        552      555       +3     
Flag Coverage Δ
unittests 91.61% <88.88%> (-0.02%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-commenter avatar Oct 21 '25 20:10 codecov-commenter