Skip to content

Conversation

@tobice
Copy link
Contributor

@tobice tobice commented Feb 13, 2024

This wraps the new /actor-builds/:build_id/log endpoint. See API reference for more information.

This wraps the new /actor-builds/<BUILD_ID>/log API.
@tobice tobice requested a review from fnesveda February 13, 2024 12:44
@tobice tobice self-assigned this Feb 13, 2024
@github-actions github-actions bot added this to the 83rd sprint - Platform team milestone Feb 13, 2024
@github-actions github-actions bot added the t-core-services Issues with this label are in the ownership of the core services team. label Feb 13, 2024
@tobice tobice changed the title feat: add log() method to BuildClient feat: add log() method to BuildClient (Python) Feb 13, 2024
@tobice
Copy link
Contributor Author

tobice commented Feb 13, 2024

@fnesveda I haven't added any tests as the existing suite is very limited and it'd take some investment to extend it properly.

This is something I'd actually like to look into, to get the tests at least on par with apify-client-js, but it's probably not the biggest burning issue right now.

@tobice tobice requested a review from drobnikj February 13, 2024 12:47
Copy link
Member

@fnesveda fnesveda left a comment

Choose a reason for hiding this comment

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

Please also add a similar method into BuildClientAsync. Unfortunately, for technical reasons, we have to maintain the sync and async versions of the client separately, which means having to do all changes twice :-/

@fnesveda
Copy link
Member

@fnesveda I haven't added any tests as the existing suite is very limited and it'd take some investment to extend it properly.

This is something I'd actually like to look into, to get the tests at least on par with apify-client-js, but it's probably not the biggest burning issue right now.

Yeah, that's OK, the tests here are pretty basic, so it would take quite a lot of effort to add new ones for specific endpoints. It would be nice to have proper tests for the client, but it's really not worth the effort right now.

When I was writing the Python API client, I decided not to replicate the test structure from the JS API client, because I didn't really like it - the unit tests basically have to mock the whole API server, which is a lot of duplicated code, and you have no guarantee that they're mocking it properly.

I was planning to come up with some proper testing framework, but that would mean rewriting half of the integration tests we have for the platform, and that seemed like a lot of effort too. And at that point we didn't know if the investment into Python tooling would be worth it, so we decided to not put in the effort into writing automated tests, and we just tested everything manually.

In the end, I think it was the right decision - the manual testing didn't take too much time, and we don't really do many structural changes to the API client that could cause bugs that only a full test suite in the API client would catch.

Anyway, I think the decision whether it's OK to keep the API client like this, with bare-bones tests, is now on @vdusek as the new owner of our Python tooling, what do you think?

If we ever decide to write proper tests here, I think we could take inspiration from the testing framework that's in the Apify SDK for Python, there the tests are much more detailed, and the test fixtures make writing tests quite easy, I would say.

@vdusek
Copy link
Contributor

vdusek commented Feb 13, 2024

Hi there, improving the test suite for the Python client is currently not on our roadmap due to the main focus on Crawlee for Python. So it's up to you guys, if you could find time to implement some better tests here, it would indeed be awesome. Otherwise, just stay with the basic tests we currently have in place.

@tobice
Copy link
Contributor Author

tobice commented Feb 14, 2024

@fnesveda Added the async API variant 👍

@tobice tobice requested a review from fnesveda February 14, 2024 09:04
@tobice
Copy link
Contributor Author

tobice commented Feb 14, 2024

Re tests, I generally don't feel comfortable submitting code without at least some test automation 😅 Manual testing is a valid option but also by definition brittle.

I also don't really have that much of a problem with mocking. For a unit test, that's fine. Just a piece of code that tells me that the new method calls the expected API endpoint and pipes back the data. For me as a new developer on the team who doesn't really understand how the client is built from within, this is already useful feedback.

With integration / e2e tests, while they are obviously preferred, maintaining a full suite on every single layer (API -> client -> SDK) is perhaps also not very economical.

Anyway, as said, this is definitely something I'd enjoy looking into (after agreeing on an approach with both of you), but it also doesn't seem like a burning issue right now.

Copy link
Member

@fnesveda fnesveda left a comment

Choose a reason for hiding this comment

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

Cool 👍

I forgot to mention it in the last review, could you also add a mention about this change to CHANGELOG.md? We unfortunately don't have automated changelog generation in the Python tooling yet.

@tobice
Copy link
Contributor Author

tobice commented Feb 14, 2024

Updated CHANGELOG.md.

@tobice tobice merged commit 1b14d4e into master Feb 14, 2024
@tobice tobice deleted the tobik/feat/add-log-method-to-build-client branch February 14, 2024 09:55
@drobnikj drobnikj added the validated Issues that are resolved and their solutions fulfill the acceptance criteria. label Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-core-services Issues with this label are in the ownership of the core services team. validated Issues that are resolved and their solutions fulfill the acceptance criteria.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants