Skip to content

Conversation

@devendra-lohar
Copy link
Contributor

@devendra-lohar devendra-lohar commented Jul 10, 2025

This is a simple CLI option that allows users to run the extractor in dry-run mode. Users will be able to use -dry-run flag.

Note:
This PR is currently blocked by another change.

@devendra-lohar devendra-lohar changed the title add dry run option initial changes [unstable] Add dry run option Jul 10, 2025
@codecov
Copy link

codecov bot commented Jul 14, 2025

Codecov Report

Attention: Patch coverage is 50.68493% with 36 lines in your changes missing coverage. Please review.

Project coverage is 78.49%. Comparing base (d86b5ed) to head (b7bc176).

Files with missing lines Patch % Lines
cognite/extractorutils/unstable/core/base.py 60.78% 20 Missing ⚠️
cognite/extractorutils/unstable/core/runtime.py 27.27% 16 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #457      +/-   ##
==========================================
- Coverage   78.98%   78.49%   -0.49%     
==========================================
  Files          42       42              
  Lines        3650     3716      +66     
==========================================
+ Hits         2883     2917      +34     
- Misses        767      799      +32     
Files with missing lines Coverage Δ
cognite/extractorutils/unstable/core/runtime.py 47.51% <27.27%> (-2.80%) ⬇️
cognite/extractorutils/unstable/core/base.py 73.91% <60.78%> (-3.02%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@devendra-lohar devendra-lohar marked this pull request as ready for review July 14, 2025 08:02
@devendra-lohar devendra-lohar requested a review from a team as a code owner July 14, 2025 08:02
Comment on lines 110 to 116
def post(self, url: str, json: dict, **kwargs: dict[str, Any]) -> _MockResponse:
self._logger.info(f"[DRY-RUN] SKIPPED POST to {url} with payload: {json}")
return self._MockResponse(url)

def get(self, url: str, **kwargs: dict[str, Any]) -> _MockResponse:
self._logger.info(f"[DRY-RUN] SKIPPED GET from {url}")
return self._MockResponse(url)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is all good, but I'd also like for us to be able to report what we're sending to the cdf. I believe the idea of a dry run especially with a combination of both dry run and debug, is for the user to know what the extractor is doing at every step.
If possible, we should also be able to show what the expected response for each data sent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed the mock response accordingly to the application config being fetched from api or not.
Logging the response properly.

self._extractor_class.CONFIG_TYPE,
)

return application_config, current_config_revision
Copy link
Contributor

@toondaey toondaey Jul 16, 2025

Choose a reason for hiding this comment

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

You should probably try to use pyright as your lsp because this is very unsafe. You could result in a situation where you get UnboundLocalError since resolving application_config and current_config_revision is behind a condition. What then happens where connection_config is None?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed this to fix UnboundLocalError

@devendra-lohar devendra-lohar requested a review from toondaey July 17, 2025 11:01
@toondaey
Copy link
Contributor

I just realized that for this to be a complete dry run, I'm not sure how this could be done, but we also need to make sure that no data flows from all the tasks. This may require that we also create a dry run of sorts for the various uploaders we have.

@devendra-lohar devendra-lohar marked this pull request as draft July 21, 2025 09:26
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.

3 participants