Skip to content

[feat] harnesses can accept cli args#122

Merged
OwenPriceSkelly merged 10 commits intomainfrom
owen/harnesses-can-accept-cli-args
Jan 9, 2026
Merged

[feat] harnesses can accept cli args#122
OwenPriceSkelly merged 10 commits intomainfrom
owen/harnesses-can-accept-cli-args

Conversation

@OwenPriceSkelly
Copy link
Member

closes #49

Before, harnesses must have been zero-argument functions:

@hog.harness()
def main():
    result = process_data.remote("hardcoded-dataset")
    return result

But a common pattern in some of the typical target use-cases (i.e. "monster scripts" that are run and re-run on a remote cluster) is to make heavy use of CLI args. We now support the following:

@hog.harness()
def main(dataset: str, epochs: int = 10, debug: bool = False):
    result = train_model.remote(dataset, epochs, debug)
    return result

We don't do any of the signature inspection or parsing ourselves; since typer is already a dependency of ours, we just turn the harness into an ad-hoc typer app with a single command at runtime. This adds a little unavoidable complexity (we need to invoke_harness_with_args instead of just calling result = harness_func()), but since we're ultimately just plugging into the very battle-tested typer/click libraries I'm not worried.

As a bonus, power-users can also directly use typer.Option or typer.Arguments in their harnesses and it should "just work" the same as it would a vanilla typer app.

@OwenPriceSkelly OwenPriceSkelly merged commit 7d124c1 into main Jan 9, 2026
2 checks passed
@OwenPriceSkelly OwenPriceSkelly deleted the owen/harnesses-can-accept-cli-args branch January 9, 2026 21:59
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 this pull request may close these issues.

feat: harnesses can accept args from CLI

1 participant