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

[dagster-fivetran] Implement base poll method in FivetranClient #26060

Merged

Conversation

maximearmstrong
Copy link
Contributor

@maximearmstrong maximearmstrong commented Nov 20, 2024

Summary & Motivation

This PR reworks legacy oll method and implements it in the FivetranClient:

  • poll_sync is added based on legacy poll_sync
  • the way of handling the connector sync status has been updated
    • Logic has been reworked and moved to FivetranConnector properties

Tests mock the request API calls and make sure that all calls are made.

How I Tested These Changes

Additional unit tests with BK

Copy link
Contributor Author

maximearmstrong commented Nov 20, 2024

@maximearmstrong maximearmstrong force-pushed the maxime/implement-resync-base-method-fivetran-client branch from cadbe37 to 90123af Compare November 20, 2024 23:24
@maximearmstrong maximearmstrong force-pushed the maxime/implement-base-poll-method-fivetran-client branch from 469b919 to 6fff27d Compare November 20, 2024 23:25
@maximearmstrong maximearmstrong marked this pull request as ready for review November 20, 2024 23:26
@maximearmstrong maximearmstrong self-assigned this Nov 20, 2024
Copy link
Contributor

@dpeng817 dpeng817 left a comment

Choose a reason for hiding this comment

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

Accepting but see comment

if connector.last_sync_completed_at > previous_sync_completed_at:
break

if poll_timeout and datetime.now() > poll_start + timedelta(seconds=poll_timeout):
Copy link
Contributor

Choose a reason for hiding this comment

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

[1]

# Sleep for the configured time interval before polling again.
time.sleep(poll_interval)

if not connector.is_last_sync_successful:
Copy link
Contributor

Choose a reason for hiding this comment

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

[2]

@@ -59,3 +61,10 @@ def test_basic_resource_request(
client.start_resync(connector_id=connector_id, resync_parameters={"property1": ["string"]})
assert len(all_api_mocks.calls) == 3
assert f"{connector_id}/schemas/tables/resync" in all_api_mocks.calls[2].request.url

# poll calls
all_api_mocks.calls.reset()
Copy link
Contributor

Choose a reason for hiding this comment

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

I know that this is just re-originating a method that exists prior to this PR, but I'm just looking at all the unexercised code paths [1] and [2]; would be nice to test failure conditions here if it's not hard. Won't block review on that, especially since the problem exists beyond just this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's totally fair - done in a55e620

@maximearmstrong maximearmstrong force-pushed the maxime/implement-resync-base-method-fivetran-client branch from 90123af to b81d516 Compare November 21, 2024 18:06
@maximearmstrong maximearmstrong force-pushed the maxime/implement-base-poll-method-fivetran-client branch from 6fff27d to 77163b2 Compare November 21, 2024 18:06
@maximearmstrong maximearmstrong force-pushed the maxime/implement-resync-base-method-fivetran-client branch from b81d516 to 004f258 Compare November 21, 2024 21:08
@maximearmstrong maximearmstrong force-pushed the maxime/implement-base-poll-method-fivetran-client branch from 77163b2 to a55e620 Compare November 21, 2024 21:08
@maximearmstrong maximearmstrong force-pushed the maxime/implement-resync-base-method-fivetran-client branch from 004f258 to 03b4f71 Compare November 21, 2024 23:45
@maximearmstrong maximearmstrong force-pushed the maxime/implement-base-poll-method-fivetran-client branch from a55e620 to 7ff0145 Compare November 21, 2024 23:45
@maximearmstrong maximearmstrong force-pushed the maxime/implement-resync-base-method-fivetran-client branch from 03b4f71 to 6855c14 Compare November 23, 2024 00:39
@maximearmstrong maximearmstrong force-pushed the maxime/implement-base-poll-method-fivetran-client branch from 3bdb351 to 0d4c5c3 Compare November 23, 2024 00:39
@maximearmstrong maximearmstrong force-pushed the maxime/implement-resync-base-method-fivetran-client branch from 6855c14 to 2021ba0 Compare November 25, 2024 13:06
@maximearmstrong maximearmstrong force-pushed the maxime/implement-base-poll-method-fivetran-client branch from 0d4c5c3 to 919e38e Compare November 25, 2024 13:06
@maximearmstrong maximearmstrong force-pushed the maxime/implement-resync-base-method-fivetran-client branch from 2021ba0 to 3df2067 Compare November 25, 2024 16:50
@maximearmstrong maximearmstrong force-pushed the maxime/implement-base-poll-method-fivetran-client branch from 919e38e to b85bbe8 Compare November 25, 2024 16:50
@maximearmstrong maximearmstrong force-pushed the maxime/implement-resync-base-method-fivetran-client branch from 3df2067 to 22bfe6c Compare November 25, 2024 23:22
@maximearmstrong maximearmstrong force-pushed the maxime/implement-base-poll-method-fivetran-client branch from b85bbe8 to c7250c1 Compare November 25, 2024 23:22
@maximearmstrong maximearmstrong force-pushed the maxime/implement-resync-base-method-fivetran-client branch from 22bfe6c to ffab308 Compare November 26, 2024 22:49
@maximearmstrong maximearmstrong force-pushed the maxime/implement-base-poll-method-fivetran-client branch from c7250c1 to 9161976 Compare November 26, 2024 22:50
@maximearmstrong maximearmstrong force-pushed the maxime/implement-resync-base-method-fivetran-client branch from ffab308 to 16121e5 Compare November 26, 2024 23:21
@maximearmstrong maximearmstrong force-pushed the maxime/implement-base-poll-method-fivetran-client branch from 9161976 to 13b8e6d Compare November 26, 2024 23:21
@maximearmstrong maximearmstrong force-pushed the maxime/implement-resync-base-method-fivetran-client branch from 16121e5 to 8a48241 Compare November 27, 2024 13:31
@maximearmstrong maximearmstrong force-pushed the maxime/implement-base-poll-method-fivetran-client branch from 13b8e6d to f039336 Compare November 27, 2024 13:32
Base automatically changed from maxime/implement-resync-base-method-fivetran-client to master November 27, 2024 13:44
@maximearmstrong maximearmstrong force-pushed the maxime/implement-base-poll-method-fivetran-client branch from f039336 to 4b0d41a Compare November 27, 2024 13:44
@maximearmstrong maximearmstrong merged commit 9fdb658 into master Nov 27, 2024
1 check passed
@maximearmstrong maximearmstrong deleted the maxime/implement-base-poll-method-fivetran-client branch November 27, 2024 14:01
cmpadden pushed a commit that referenced this pull request Dec 5, 2024
## Summary & Motivation

This PR reworks legacy oll method and implements it in the
`FivetranClient`:

-  `poll_sync` is added based on legacy `poll_sync`
- the way of handling the connector sync status has been updated 
  - Logic has been reworked and moved to `FivetranConnector` properties 

Tests mock the request API calls and make sure that all calls are made.

## How I Tested These Changes

Additional unit tests with BK
pskinnerthyme pushed a commit to pskinnerthyme/dagster that referenced this pull request Dec 16, 2024
…ter-io#26060)

## Summary & Motivation

This PR reworks legacy oll method and implements it in the
`FivetranClient`:

-  `poll_sync` is added based on legacy `poll_sync`
- the way of handling the connector sync status has been updated 
  - Logic has been reworked and moved to `FivetranConnector` properties 

Tests mock the request API calls and make sure that all calls are made.

## How I Tested These Changes

Additional unit tests with BK
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.

2 participants