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

[AG-1557] Fixes ModelAD File size must be at least one byte Error #150

Merged
merged 4 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()