Skip to content

Commit

Permalink
[AG-1557] Fixes ModelAD File size must be at least one byte Error (#…
Browse files Browse the repository at this point in the history
…150)

* updates argument and option descriptions

* check for reports

* adds test coverage

* updates docs
  • Loading branch information
BWMac authored Oct 23, 2024
1 parent 105ddc9 commit 0bae86a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Perform the following one-time steps to set up your local environment and obtain
pipenv shell
```

6. You can check if the package was isntalled correctly by running `adt --help` in the terminal. If it returns instructions about how to use the CLI, installation was successful and you can run the pipeline by providing the desired [config file](#config) as an argument. The following example command will execute the pipeline using ```test_config.yaml```:
6. You can check if the package was isntalled correctly by running `adt --help` in the terminal. If it returns instructions about how to use the CLI, installation was successful and you can run the pipeline by providing the desired [config file](#config) as an argument. Be sure to review these instructions prior to executing a processing run. The following example command will execute the pipeline using ```test_config.yaml```:

```bash
adt test_config.yaml
Expand Down
13 changes: 9 additions & 4 deletions src/agoradatatools/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,27 +301,32 @@ def process_all_files(

app = Typer()

input_path_arg = Argument(..., help="Path to configuration file for processing run")
input_path_arg = Argument(
..., help="Path to configuration file for processing run (Required)."
)

platform_opt = Option(
"LOCAL",
"--platform",
"-p",
help="Platform that is running the process. Must be one of LOCAL, GITHUB, or NEXTFLOW.",
help="Platform that is running the process. Must be one of LOCAL, GITHUB, or NEXTFLOW (Optional).",
show_default=True,
)
run_id_opt = Option(
None,
"--run_id",
"-r",
help="Run ID of the process.",
help="Run ID of the process. This is used to identify the run in the GX table. (Optional)",
show_default=True,
)
upload_opt = Option(
False,
"--upload",
"-u",
help="Toggles whether or not files will be uploaded to Synapse.",
help="Toggles whether or not files will be uploaded to Synapse. The absence of this option means "
"that neither output data files nor GX reports will be uploaded to Synapse. Setting "
"`--upload` in the command will cause both to be uploaded. This option is used to control "
"the upload behavior of the process.",
show_default=True,
)
synapse_auth_opt = Option(
Expand Down
3 changes: 1 addition & 2 deletions src/agoradatatools/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,8 @@ def _update_reports_before_upload(self) -> None:

def update_table(self) -> None:
"""Updates the Synapse table adding one new row for each DatasetReport object if the platform is not LOCAL."""
if self.platform != Platform.LOCAL:
if self.platform != Platform.LOCAL and self.reports:
self._update_reports_before_upload()

self.syn.store(
synapseclient.Table(
self.table_id,
Expand Down
12 changes: 11 additions & 1 deletion tests/test_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ def test_update_reports_before_upload(self, mock_datetime):
mock_datetime.datetime.now.return_value.strftime.assert_called_once()
assert self.test_reporter.reports[0] == self.upload_report

def test_update_table(self, syn):
def test_update_table_platform_not_local_and_reports_not_empty(self, syn):
with patch.object(syn, "store") as mock_store, patch.object(
self.test_reporter, "_update_reports_before_upload"
) as mock_update_reports_before_upload:
self.test_reporter.reports = [self.test_report]
self.test_reporter.update_table()

mock_store.assert_called_once()
Expand All @@ -88,3 +89,12 @@ def test_update_table_when_platform_is_local(self, syn):

mock_store.assert_not_called()
mock_update_reports_before_upload.assert_not_called()

def test_update_table_platform_not_local_and_reports_empty(self, syn):
with patch.object(syn, "store") as mock_store, patch.object(
self.test_reporter, "_update_reports_before_upload"
) as mock_update_reports_before_upload:
self.test_reporter.update_table()

mock_store.assert_not_called()
mock_update_reports_before_upload.assert_not_called()

0 comments on commit 0bae86a

Please sign in to comment.