Skip to content

Commit

Permalink
Add better docblock for target (#23635)
Browse files Browse the repository at this point in the history
## Summary & Motivation

We added `target` to `sensor`, `SensorDefinition`, `schedule`, and
`ScheduleDefinition` in 1.8 but documented it poorly. This adds a more
fleshed out docblock.

## How I Tested These Changes

Read.

![Screenshot 2024-08-13 at
3.51.09 PM.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/wS38mdcdU6aAeJobBdry/e19e5d8d-b270-4846-af51-d25c43ea41b2.png)
  • Loading branch information
schrockn authored Aug 14, 2024
1 parent 170faf5 commit 98b6737
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 0 deletions.
Binary file modified docs/content/api/modules.json.gz
Binary file not shown.
Binary file modified docs/content/api/searchindex.json.gz
Binary file not shown.
Binary file modified docs/content/api/sections.json.gz
Binary file not shown.
Binary file modified docs/next/public/objects.inv
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ def schedule(
required_resource_keys (Optional[Set[str]]): The set of resource keys required by the schedule.
target (Optional[Union[CoercibleToAssetSelection, AssetsDefinition, JobDefinition, UnresolvedAssetJobDefinition]]):
The target that the schedule will execute.
It can take :py:class:`~dagster.AssetSelection` objects and anything coercible to it (e.g. `str`, `Sequence[str]`, `AssetKey`, `AssetsDefinition`).
It can also accept :py:class:`~dagster.JobDefinition` (a function decorated with `@job` is an instance of `JobDefinition`) and `UnresolvedAssetJobDefinition` (the return value of :py:func:`~dagster.define_asset_job`) objects.
This is an experimental parameter that will replace `job` and `job_name`.
"""

def inner(fn: RawScheduleEvaluationFunction) -> ScheduleDefinition:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ def sensor(
This can be provided instead of specifying a job.
target (Optional[Union[CoercibleToAssetSelection, AssetsDefinition, JobDefinition, UnresolvedAssetJobDefinition]]):
The target that the sensor will execute.
It can take :py:class:`~dagster.AssetSelection` objects and anything coercible to it (e.g. `str`, `Sequence[str]`, `AssetKey`, `AssetsDefinition`).
It can also accept :py:class:`~dagster.JobDefinition` (a function decorated with `@job` is an instance of `JobDefinition`) and `UnresolvedAssetJobDefinition` (the return value of :py:func:`~dagster.define_asset_job`) objects.
This is an experimental parameter that will replace `job`, `jobs`, and `asset_selection`.
"""
check.opt_str_param(name, "name")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,9 @@ class ScheduleDefinition(IHasInternalInit):
required_resource_keys (Optional[Set[str]]): The set of resource keys required by the schedule.
target (Optional[Union[CoercibleToAssetSelection, AssetsDefinition, JobDefinition, UnresolvedAssetJobDefinition]]):
The target that the schedule will execute.
It can take :py:class:`~dagster.AssetSelection` objects and anything coercible to it (e.g. `str`, `Sequence[str]`, `AssetKey`, `AssetsDefinition`).
It can also accept :py:class:`~dagster.JobDefinition` (a function decorated with `@job` is an instance of `JobDefinition`) and `UnresolvedAssetJobDefinition` (the return value of :py:func:`~dagster.define_asset_job`) objects.
This is an experimental parameter that will replace `job` and `job_name`.
"""

def with_updated_job(self, new_job: ExecutableDefinition) -> "ScheduleDefinition":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,9 @@ class SensorDefinition(IHasInternalInit):
This can be provided instead of specifying a job.
target (Optional[Union[CoercibleToAssetSelection, AssetsDefinition, JobDefinition, UnresolvedAssetJobDefinition]]):
The target that the sensor will execute.
It can take :py:class:`~dagster.AssetSelection` objects and anything coercible to it (e.g. `str`, `Sequence[str]`, `AssetKey`, `AssetsDefinition`).
It can also accept :py:class:`~dagster.JobDefinition` (a function decorated with `@job` is an instance of `JobDefinition`) and `UnresolvedAssetJobDefinition` (the return value of :py:func:`~dagster.define_asset_job`) objects.
This is an experimental parameter that will replace `job`, `jobs`, and `asset_selection`.
"""

def with_updated_jobs(self, new_jobs: Sequence[ExecutableDefinition]) -> "SensorDefinition":
Expand Down

1 comment on commit 98b6737

@github-actions
Copy link

Choose a reason for hiding this comment

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

Deploy preview for dagster-docs ready!

✅ Preview
https://dagster-docs-qfvn20s5n-elementl.vercel.app
https://master.dagster.dagster-docs.io

Built with commit 98b6737.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.