Skip to content

Commit

Permalink
Fix docstring
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Romeyn <mromeijn@nvidia.com>
  • Loading branch information
marcromeyn committed Aug 23, 2024
1 parent 2bdfa0a commit 6c47eaa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
1 change: 0 additions & 1 deletion examples/entrypoint/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def my_optimizer(
)


@run.cli.entrypoint
def train_model(
model: Model = my_model(),
optimizer: Optimizer = my_optimizer(),
Expand Down
21 changes: 14 additions & 7 deletions src/nemo_run/cli/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,10 @@ def main(fn: F):
Execute the main CLI entrypoint for the given function.
This function is used to run the CLI entrypoint associated with a decorated function.
It checks if the function is properly decorated as an entrypoint and then executes its main CLI logic.
If the function is not decorated as an entrypoint, it will be wrapped with the default entrypoint.
Args:
fn (F): The function decorated with the @entrypoint decorator.
Raises:
ValueError: If the provided function is not decorated as an entrypoint.
fn (F): The function to be executed as a CLI entrypoint.
Example:
@entrypoint
Expand All @@ -210,7 +207,8 @@ def my_cli_function():
main(my_cli_function)
"""
if not isinstance(fn, EntrypointProtocol):
raise ValueError("The function is not an entrypoint.")
# Wrap the function with the default entrypoint
fn = entrypoint()(fn)

fn.cli_entrypoint.main()

Expand Down Expand Up @@ -745,11 +743,20 @@ def command(

def launch(self, experiment: Experiment, sequential: bool = False):
"""
Launch the given experiment.
Launch the given experiment, respecting the RunContext settings.
This method launches the experiment, taking into account the various options
set in the RunContext, such as dryrun, detach, direct execution, and log tailing.
Args:
experiment (Experiment): The experiment to launch.
sequential (bool): If True, run the experiment sequentially.
Note:
- If self.dryrun is True, it will only perform a dry run of the experiment.
- The method respects self.detach for detached execution.
- It uses direct execution if self.direct is True or if no executor is set.
- Log tailing behavior is controlled by self.tail_logs.
"""
if self.dryrun:
experiment.dryrun()
Expand Down

0 comments on commit 6c47eaa

Please sign in to comment.