Skip to content

Improve downloader interface#59

Merged
Roni-Katz merged 6 commits into
devfrom
improve_downloader_interface
May 4, 2025
Merged

Improve downloader interface#59
Roni-Katz merged 6 commits into
devfrom
improve_downloader_interface

Conversation

@Roni-Katz

Copy link
Copy Markdown
Contributor

No description provided.

@Roni-Katz
Roni-Katz requested a review from roygutg March 9, 2025 13:28
@Roni-Katz
Roni-Katz changed the base branch from main to dev March 9, 2025 13:28

@roygutg roygutg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All changes to Downloader look good!

But notice that it's still running write_csv as part of the download method. As you wrote in TODO, that can be removed. That would require a change in the test_downloader function in test_behavioral_pipeline.py: either adding a call to dump after downloading, or assigning the return value of download directly to the raw variable, instead of its current definition. Only then we can make sure that the new output formatting passes the downloader tests.

Additionally, it's finally time to delete the long TODO under create_output, in current lines 142-147. Please do that :)

Regarding the changes to Parser, it seems to not be working as expected. test_parser in test_behavioral_pipeline.py is failing for me (running remotely on lab linux). From a quick look, it seems like all shape IDs parse as None, and all shapes have a gallery save time for some reason. Please look into that.

Thanks!

Comment thread CFGpy/behavioral/Downloader.py Outdated
Comment thread CFGpy/behavioral/Downloader.py Outdated
output_file_writer.writerow(output_json_record)

if verbose:
print(f"Wrote CSV to {self.output_filename}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this can go in the dump method

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread CFGpy/behavioral/Parser.py Outdated
@roygutg roygutg linked an issue Mar 10, 2025 that may be closed by this pull request

@roygutg roygutg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

HI,
Sorry for the delay on this.

Parser tests pass smoothly now :)
Downloader tests are still not, because the output is not saved (should be either dumped and read, or assigned to raw - see my last comment on that).

Also, lmk what you think about the remaining unresolved comments.
Thanks!

@Roni-Katz

Copy link
Copy Markdown
Contributor Author

No worries, thank you for reviewing. I ran all tests - I thought I fixed the downloader tests, I must have just not pushed those changes by mistake because everything was running fine by me.

@Roni-Katz

Copy link
Copy Markdown
Contributor Author

I will look at the other comments tomorrow, I seem to have missed them.

@roygutg roygutg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All tests pass now on my side too :)

But I don't see the changes relating to the other comments. Maybe still missing some commits?

@Roni-Katz

Copy link
Copy Markdown
Contributor Author

I was just waiting to run the tests and haven't had a chance - they take like 2 and a half hours

@roygutg roygutg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey,
Again, sorry for the long delay!
I still don't see the changes to the dump method mentioned in the comments, but that's not imperative.
All tests are still working fine on my side, and none of the remaining issues is crucial. Given my availability constraints, I think it's best to just be done with this CR :)
If you want, you can address the remaining comments before merging.

To finish this up, please use the GitHub web interface to squash and merge. Then, once indicated "safe", delete this branch. Lastly, please go to #14 and close it with a comment saying it was resolved by this PR (with a link back here).
Thank you!

Comment thread CFGpy/behavioral/Downloader.py Outdated
@@ -1,4 +1,5 @@
import csv

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

no longer needed

output_json_record[self.config.RAW_PLAYER_CUSTOM_DATA] = player.get("customData")
return output_json_record

def _create_df(self, *, output_json: dict, verbose: Optional[bool] = False) -> pd.DataFrame:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is called from create_downloader_output with output_json as a type list[dict]

@Roni-Katz

Copy link
Copy Markdown
Contributor Author

Hi Roy,
Thank you. Sorry I didn't manage to push the last few changes before I left for SA for Pesach. I will run the tests with the changes and then I will do everything you said. Thank you for your help!

@Roni-Katz
Roni-Katz merged commit 7ab666e into dev May 4, 2025
@Roni-Katz Roni-Katz mentioned this pull request May 4, 2025
@Roni-Katz
Roni-Katz deleted the improve_downloader_interface branch May 5, 2025 09:19
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.

Rewrite Downloader

2 participants