Skip to content

Commit

Permalink
Fix #6512 (#6969)
Browse files Browse the repository at this point in the history
  • Loading branch information
petehunt committed Mar 15, 2022
1 parent 7a78835 commit 75b48ea
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 21 deletions.
5 changes: 4 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ All content is in the `/content` folder.

**_Try it out_**

Open http://localhost:3001/concepts/solids-pipelines/solids in your browser, and the file `/content/concepts/solid-pipelines/solids.mdx` in your editor. Try editing the file and see your changes be reflected live in the browser.
Open http://localhost:3001/concepts/ops-jobs-graphs/ops in your browser, and the file `/content/concepts/ops-jobs-graphs/ops.mdx` in your editor. Try editing the file and see your changes be reflected live in the browser.

---

Expand Down Expand Up @@ -132,18 +132,21 @@ If you are adding a new page or want to update the navigation in the sidebar, up
Docs screenshots are generated manually. Previously, this meant that you would run Dagit and hit Shift-Command-4. Now, we are moving towards using the `docs/screenshot_capture/capture-screenshot.py` script, which adds some automation. To use it, you add a "screenshot spec" to `docs/screenshot_capture/screenshots.yaml` and then run the script to generate an image from that spec.

A screenshot spec includes:

- A `path` to an image file that the screenshot should be stored in.
- A `defs_file` that the script will run `dagit -f` or `dagit -w` on to load a set of Dagster definitions.
- A `url` for the page to take the screenshot from.
- An optional set of manual `steps`, which the person generating the screenshot is expected to carry out before the screenshot is taken.
- A `vetted` boolean, which indicates whether the current screenshot in the repo was generated using the spec.

#### Setup

```
pip install selenium
```

Install Selenium's chrome driver:

- `brew install chromedriver` OR download chromedriver from [here](https://chromedriver.chromium.org/downloads)) and manually add to /usr/local/bin
- You may need to run `xattr -d com.apple.quarantine /usr/local/bin/chromedriver` (gross)

Expand Down
2 changes: 1 addition & 1 deletion docs/content/api/modules.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/content/api/sections.json

Large diffs are not rendered by default.

12 changes: 4 additions & 8 deletions docs/content/concepts/ops-jobs-graphs/ops.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ An op only starts to execute once all of its inputs have been resolved. Inputs c
You can use a [Dagster Type](/concepts/types) to provide a function that validates an op's input every time the op runs. In this case, you use a dictionary of <PyObject object="In" pluralize /> corresponding to the decorated function arguments.

```python file=/concepts/solids_pipelines/solids.py startafter=start_typed_input_op_marker endbefore=end_typed_input_op_marker
MyDagsterType = DagsterType(
type_check_fn=lambda _, value: value % 2 == 0, name="MyDagsterType"
)
MyDagsterType = DagsterType(type_check_fn=lambda _, value: value % 2 == 0, name="MyDagsterType")


@op(ins={"abc": In(dagster_type=MyDagsterType)})
Expand Down Expand Up @@ -156,15 +154,13 @@ You may find the need to create utilities that help generate ops. In most cases,
To create an op factory, you define a function that returns an <PyObject object="OpDefinition"/>, either directly or by decorating a function with the op decorator.

```python file=/concepts/solids_pipelines/solids.py startafter=start_op_factory_pattern_marker endbefore=end_op_factory_pattern_marker
def x_op(
arg,
def my_op_factory(
name="default_name",
ins=None,
**kwargs,
):
"""
Args:
args (any): One or more arguments used to generate the new op
name (str): The name of the new op.
ins (Dict[str, In]): Any Ins for the new op. Default: None.
Expand All @@ -173,9 +169,9 @@ def x_op(
"""

@op(name=name, ins=ins or {"start": In(Nothing)}, **kwargs)
def _x_op():
def my_inner_op(**kwargs):
# Op logic here
pass

return _x_op
return my_inner_op
```
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ def my_input_op(abc, xyz):

# start_typed_input_op_marker

MyDagsterType = DagsterType(
type_check_fn=lambda _, value: value % 2 == 0, name="MyDagsterType"
)
MyDagsterType = DagsterType(type_check_fn=lambda _, value: value % 2 == 0, name="MyDagsterType")


@op(ins={"abc": In(dagster_type=MyDagsterType)})
Expand Down Expand Up @@ -94,15 +92,13 @@ def context_op(context):
# end_op_context_marker

# start_op_factory_pattern_marker
def x_op(
arg,
def my_op_factory(
name="default_name",
ins=None,
**kwargs,
):
"""
Args:
args (any): One or more arguments used to generate the new op
name (str): The name of the new op.
ins (Dict[str, In]): Any Ins for the new op. Default: None.
Expand All @@ -111,11 +107,11 @@ def x_op(
"""

@op(name=name, ins=ins or {"start": In(Nothing)}, **kwargs)
def _x_op():
def my_inner_op(**kwargs):
# Op logic here
pass

return _x_op
return my_inner_op


# end_op_factory_pattern_marker
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
my_op,
my_output_op,
my_typed_input_op,
x_op,
my_op_factory,
)


Expand Down Expand Up @@ -50,5 +50,5 @@ def test_my_configurable_op():


def test_op_factory():
factory_op = x_op("test")
factory_op = my_op_factory("test")
assert isinstance(factory_op, OpDefinition)

1 comment on commit 75b48ea

@vercel
Copy link

@vercel vercel bot commented on 75b48ea Mar 15, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.