Skip to content

Commit

Permalink
Merge branch 'docs/revamp' into jb-more-theme-work
Browse files Browse the repository at this point in the history
  • Loading branch information
PedramNavid authored Aug 17, 2024
2 parents dc8a39d + af3c47e commit 14752ca
Show file tree
Hide file tree
Showing 16 changed files with 91 additions and 38 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
from dagster import (
AssetExecutionContext,
AssetKey,
Definitions,
EventLogEntry,
RunRequest,
SensorEvaluationContext,
asset,
asset_sensor,
define_asset_job,
)


@asset
def daily_sales_data(context: AssetExecutionContext):
context.log.info("Asset to watch")


@asset
def weekly_report(context: AssetExecutionContext):
context.log.info("Asset to trigger")


my_job = define_asset_job("my_job", [weekly_report])


# highlight-start
@asset_sensor(asset_key=AssetKey("daily_sales_data"), job=my_job)
def daily_sales_data_sensor(context: SensorEvaluationContext, asset_event: EventLogEntry):
# This satisifies the type checker. Asset events are guaranteed to have a dagster_event and asset_key.
assert asset_event.dagster_event is not None
assert asset_event.dagster_event.asset_key is not None

return RunRequest(
run_key=context.cursor,
run_config={
"ops": {
"read_materialization": {
"config": {
"asset_key": asset_event.dagster_event.asset_key.path,
}
}
}
},
) # highlight-end


defs = Definitions(
assets=[daily_sales_data, weekly_report],
jobs=[my_job],
sensors=[daily_sales_data_sensor],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from dagster import (
AssetExecutionContext,
AssetKey,
Definitions,
RunRequest,
asset,
asset_sensor,
define_asset_job,
)


@asset
def daily_sales_data(context: AssetExecutionContext):
context.log.info("Asset to watch")


@asset
def weekly_report(context: AssetExecutionContext):
context.log.info("Asset to trigger")


my_job = define_asset_job("my_job", [weekly_report])


# highlight-start
@asset_sensor(asset_key=AssetKey("daily_sales_data"), job_name="my_job")
def daily_sales_data_sensor():
return RunRequest()
# highlight-end


defs = Definitions(
assets=[daily_sales_data, weekly_report],
jobs=[my_job],
sensors=[daily_sales_data_sensor],
)

This file was deleted.

2 changes: 1 addition & 1 deletion docs/docs-next/src/components/CodeExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const CodeExample: React.FC<CodeExampleProps> = ({filePath, language, title}) =>

React.useEffect(() => {
// Adjust the import path to start from the docs directory
import(`!!raw-loader!/docs/${filePath}`)
import(`!!raw-loader!/docs/code_examples/${filePath}`)
.then((module) => {
const lines = module.default.split('\n');
const mainIndex = lines.findIndex((line) => line.trim().startsWith('if __name__ == '));
Expand Down
1 change: 1 addition & 0 deletions docs/docs-next/src/styles/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ html {
font-family: var(--ifm-font-family-base);
background: var(--theme-color-background-default);
}

article {
max-width: 720px;
margin: 0 auto;
Expand Down
2 changes: 1 addition & 1 deletion docs/docs-next/src/styles/theme-light.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
--ifm-menu-color-active: var(--theme-color-background-blue);

// docusaurus
--docusaurus-highlighted-code-line-bg: var(--theme-background-light);
--docusaurus-highlighted-code-line-bg: var(--theme-color-background-blue);

// infima shadow levels
// generated from https://www.joshwcomeau.com/shadow-palette/
Expand Down

0 comments on commit 14752ca

Please sign in to comment.