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

Introducing a pythonic CLI #5

Merged
merged 27 commits into from
Aug 26, 2024
Merged

Introducing a pythonic CLI #5

merged 27 commits into from
Aug 26, 2024

Conversation

marcromeyn
Copy link
Collaborator

No description provided.

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link
Collaborator

@hemildesai hemildesai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try rebasing on the latest main? That should update some of the deleted docstrings.

docs/img/task-help.png Outdated Show resolved Hide resolved
@@ -1,72 +1,50 @@
# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we remove this header?

src/nemo_run/core/runners/fdl_runner.py Show resolved Hide resolved
src/nemo_run/run/experiment.py Outdated Show resolved Hide resolved
@@ -317,7 +320,13 @@ def _save_tasks(self):
with open(os.path.join(self._exp_dir, self.__class__._TASK_FILE), "w+") as f:
json.dump(serialized_tasks, f)

if "__main__" in sys.modules:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this work for remote executors as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is called on the node that's configuring the experiment. The output is put inside the experiment dir, which I am under the impression is accessible for the remote executor?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the necessary files are accessible remotely, which currently just includes the configs and the code. You'll have to edit the executors to include the copying of this file.

src/nemo_run/config.py Outdated Show resolved Hide resolved
src/nemo_run/config.py Outdated Show resolved Hide resolved
src/nemo_run/config.py Outdated Show resolved Hide resolved
src/nemo_run/config.py Outdated Show resolved Hide resolved
src/nemo_run/api.py Outdated Show resolved Hide resolved
is_target_default: bool = False,
name: Optional[str] = None,
namespace: Optional[str] = None,
) -> F: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
is_target_default: bool = False,
name: Optional[str] = None,
namespace: Optional[str] = None,
) -> F: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
@@ -95,6 +448,20 @@
return app


@runtime_checkable
class EntrypointProtocol(Protocol):
def cli_entrypoint(self) -> "Entrypoint": ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
src/nemo_run/cli/api.py Dismissed Show dismissed Hide dismissed
src/nemo_run/cli/api.py Dismissed Show dismissed Hide dismissed
@@ -61,7 +62,9 @@
def create() -> typer.Typer:
app = typer.Typer()

CLI(launch).cli(app)
from nemo_run.cli.api import Entrypoint

Check notice

Code scanning / CodeQL

Cyclic import Note

Import of module
nemo_run.cli.api
begins an import cycle.
src/nemo_run/run/experiment.py Fixed Show fixed Hide fixed
test/cli/test_api.py Fixed Show fixed Hide fixed
test/cli/test_api.py Fixed Show fixed Hide fixed
from rich.console import Console
from typer.testing import CliRunner

import nemo_run as run

Check notice

Code scanning / CodeQL

Module is imported with 'import' and 'import from' Note test

Module 'nemo_run' is imported with both 'import' and 'import from'.
# limitations under the License.

import ast
import functools

Check notice

Code scanning / CodeQL

Module is imported with 'import' and 'import from' Note

Module 'functools' is imported with both 'import' and 'import from'.
Signed-off-by: Marc Romeyn <[email protected]>
Signed-off-by: Marc Romeyn <[email protected]>
Signed-off-by: Marc Romeyn <[email protected]>
Signed-off-by: Marc Romeyn <[email protected]>
Signed-off-by: Marc Romeyn <[email protected]>
Signed-off-by: Marc Romeyn <[email protected]>
Signed-off-by: Marc Romeyn <[email protected]>
Signed-off-by: Marc Romeyn <[email protected]>
Signed-off-by: Marc Romeyn <[email protected]>
Signed-off-by: Marc Romeyn <[email protected]>
Signed-off-by: Marc Romeyn <[email protected]>
Signed-off-by: Marc Romeyn <[email protected]>
Signed-off-by: Marc Romeyn <[email protected]>
Signed-off-by: Marc Romeyn <[email protected]>
Signed-off-by: Marc Romeyn <[email protected]>
src/nemo_run/config.py Outdated Show resolved Hide resolved
src/nemo_run/api.py Outdated Show resolved Hide resolved
src/nemo_run/api.py Outdated Show resolved Hide resolved
src/nemo_run/core/lark_parser.py Show resolved Hide resolved
@@ -317,7 +320,13 @@ def _save_tasks(self):
with open(os.path.join(self._exp_dir, self.__class__._TASK_FILE), "w+") as f:
json.dump(serialized_tasks, f)

if "__main__" in sys.modules:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the necessary files are accessible remotely, which currently just includes the configs and the code. You'll have to edit the executors to include the copying of this file.

Signed-off-by: Marc Romeyn <[email protected]>
for ep in entrypoints:
ep.load()
except Exception:
...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
@marcromeyn marcromeyn requested a review from hemildesai August 26, 2024 17:18
@marcromeyn marcromeyn merged commit d614a8a into main Aug 26, 2024
7 checks passed
@marcromeyn marcromeyn deleted the pythonic-cli branch August 26, 2024 17:31
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.

2 participants