-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(data-warehouse): DLT + temporal (#18700)
* testing * draft * tests * working rough draft * split workflow and activity workers * temp * split task queues * add schedule * working with schedule * add bucket stitching activity * sync data steps for pipeline * add comment * update default endpoints * workflow with all steps * update heartbeat * update env var, update folders so there are common and specific workflow modules * update workflow * update imports * reformat * already sync * format * adjust async methods * make it readable * remove extra * remove unnecessary config * add invoices to default endpoint * change heartbeat name * remove * update dev packages * update migration * package and tests * update test import path * restore task queue env var and remove unnecessary ones, update github action to only trigger deploy for respective worker * fix tests * typing * revert task queue change * update github action and env vars * poll reload * update retry * change activity stiching function back to sync for now * typing * try to import differently * Update query snapshots * Update query snapshots * remap * move * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (2) * Update UI snapshots for `chromium` (1) * sort * update import * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (1) * typing * add notes on logging * make sure datawarehousetable filtering works right * update timeout and how datawarehouse tables are linked * sort * add delete * Update UI snapshots for `chromium` (1) * Update UI snapshots for `chromium` (1) --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
022996d
commit 2a6a13c
Showing
52 changed files
with
1,297 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import asyncio | ||
import collections.abc | ||
import datetime as dt | ||
import typing | ||
|
||
import temporalio.activity | ||
|
||
|
||
class AsyncHeartbeatDetails(typing.NamedTuple): | ||
"""Details sent over in a Temporal Activity heartbeat.""" | ||
|
||
def make_activity_heartbeat_while_running( | ||
self, function_to_run: collections.abc.Callable, heartbeat_every: dt.timedelta | ||
) -> collections.abc.Callable[..., collections.abc.Coroutine]: | ||
"""Return a callable that returns a coroutine that heartbeats with these HeartbeatDetails. | ||
The returned callable wraps 'function_to_run' while heartbeating every 'heartbeat_every' | ||
seconds. | ||
""" | ||
|
||
async def heartbeat() -> None: | ||
"""Heartbeat every 'heartbeat_every' seconds.""" | ||
while True: | ||
await asyncio.sleep(heartbeat_every.total_seconds()) | ||
temporalio.activity.heartbeat(self) | ||
|
||
async def heartbeat_while_running(*args, **kwargs): | ||
"""Wrap 'function_to_run' to asynchronously heartbeat while awaiting.""" | ||
heartbeat_task = asyncio.create_task(heartbeat()) | ||
|
||
try: | ||
return await function_to_run(*args, **kwargs) | ||
finally: | ||
heartbeat_task.cancel() | ||
await asyncio.wait([heartbeat_task]) | ||
|
||
return heartbeat_while_running |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from posthog.temporal.data_imports.external_data_job import * | ||
|
||
WORKFLOWS = [ExternalDataJobWorkflow] | ||
|
||
ACTIVITIES = [ | ||
create_external_data_job_model, | ||
update_external_data_job_model, | ||
run_external_data_job, | ||
move_draft_to_production_activity, | ||
validate_schema_activity, | ||
] |
Oops, something went wrong.