Skip to content

Commit

Permalink
Regression inside command line tools [cmf artifact/execution list com…
Browse files Browse the repository at this point in the history
…mand] (#218)

* Modified code

* return data instead of assigned it to var

* Added comment and optimized code

* Modified command descriptions

* Handled all testing scenario inside cmf artifact list cmd

* Enhancement of -j option in cmf metadata export cmd

* Updated help descriptions for every command.

* Added proper comment, descriptions and warnings.

* Added proper comments inside code.

* Modified description of command and update document.

* Updated description for cmf artifact/execution list command

* Made changes inside cmf artifact/execution list code

* Added 'name' as a properties inside execution list cmd.

* Removed long option.
  • Loading branch information
AyeshaSanadi authored Dec 12, 2024
1 parent 462e9e4 commit 239dc51
Show file tree
Hide file tree
Showing 10 changed files with 505 additions and 196 deletions.
28 changes: 13 additions & 15 deletions cmflib/cmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2305,7 +2305,7 @@ def non_related_args(type : str, args : dict):


def pipeline_list(filepath = "./mlmd"):
""" Display list of pipline for current mlmd.
""" Display a list of pipeline name(s) from the available mlmd file.
Example:
```python
Expand All @@ -2323,43 +2323,41 @@ def pipeline_list(filepath = "./mlmd"):
return output


def execution_list(pipeline_name: str, filepath = "./mlmd", execution_id: str = "", long = True):
""" Display list of execution for given pipeline.
def execution_list(pipeline_name: str, filepath = "./mlmd", execution_id: str = ""):
"""Displays executions from the MLMD file with a few properties in a 7-column table, limited to 20 records per page.
Example:
```python
result = _execution_list("example_pipeline", "./mlmd_directory", "example_execution_id", "long")
result = _execution_list("example_pipeline", "./mlmd_directory", "example_execution_id")
```
Args:
pipeline_name: Name of the pipeline.
filepath: Path to store the mlmd file.
execution_id: Executions for particular execution id.
long: Detailed summary regarding execution.
execution_id: Executions for particular execution id.
Returns:
Output from the _execution_list function.
"""

# Required arguments: pipeline_name
# Optional arguments: filepath( path to store mlmd file), execution_id, long
output = _execution_list(pipeline_name, filepath, execution_id, long)
# Optional arguments: filepath( path to store mlmd file), execution_id
output = _execution_list(pipeline_name, filepath, execution_id)
return output


def artifact_list(pipeline_name: str, filepath = "./mlmd", artifact_name: str = "", long = True):
""" Display list of artifact for given pipeline.
def artifact_list(pipeline_name: str, filepath = "./mlmd", artifact_name: str = ""):
""" Displays artifacts from the MLMD file with a few properties in a 7-column table, limited to 20 records per page.
Example:
```python
result = _artifact_list("example_pipeline", "./mlmd_directory", "example_artifact_name", "long")
result = _artifact_list("example_pipeline", "./mlmd_directory", "example_artifact_name")
```
Args:
pipeline_name: Name of the pipeline.
filepath: Path to store the mlmd file.
artifact_name: Artifacts for particular artifact name.
long: Detailed summary regarding artifact.
artifact_name: Artifacts for particular artifact name.
Returns:
Output from the _artifact_list function.
"""

# Required arguments: pipeline_name
# Optional arguments: filepath( path to store mlmd file), artifact_name, long
output = _artifact_list(pipeline_name, filepath, artifact_name, long)
# Optional arguments: filepath( path to store mlmd file), artifact_name
output = _artifact_list(pipeline_name, filepath, artifact_name)
return output
12 changes: 4 additions & 8 deletions cmflib/cmf_commands_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def _init_osdfremote(path, key_id, key_path, key_issuer, git_remote_url, cmf_ser
print(msg)
return msg

def _artifact_list(pipeline_name, file_name, artifact_name, long):
def _artifact_list(pipeline_name, file_name, artifact_name):
cli_args = cli.parse_args(
[
"artifact",
Expand All @@ -292,9 +292,7 @@ def _artifact_list(pipeline_name, file_name, artifact_name, long):
"-f",
file_name,
"-a",
artifact_name,
"-l",
long
artifact_name
]
)
cmd = cli_args.func(cli_args)
Expand All @@ -316,7 +314,7 @@ def _pipeline_list(file_name):
print(msg)
return msg

def _execution_list(pipeline_name, file_name, execution_id, long):
def _execution_list(pipeline_name, file_name, execution_id):
cli_args = cli.parse_args(
[
"execution",
Expand All @@ -326,9 +324,7 @@ def _execution_list(pipeline_name, file_name, execution_id, long):
"-f",
file_name,
"-e",
execution_id,
"-l",
long
execution_id
]
)
cmd = cli_args.func(cli_args)
Expand Down
Loading

0 comments on commit 239dc51

Please sign in to comment.