Skip to content

Commit

Permalink
[docs] Fix syntax errors on k8s pipes examples (#19425)
Browse files Browse the repository at this point in the history
## Summary & Motivation

Fix handful of syntax errors on the Kubernetes Pipes docs examples.

- fix Dockerfile syntax - add RUN and ENTRYPOINT directives
- fix docker build syntax - add local directory
- remove Pipes parameter example that is incomplete (neither passed nor
retrieved correctly)
- fix inconsistent image name on second example

## How I Tested These Changes

Ran examples locally with these changes, confirmed working
Rebuilt docs
  • Loading branch information
cameronmartin authored Feb 7, 2024
1 parent b1e59a1 commit 0a93b7e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions docs/content/guides/dagster-pipes/kubernetes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ from dagster_pipes import open_dagster_pipes

with open_dagster_pipes() as pipes:
# Stream log message back to Dagster
pipes.log.info(f"Using some_parameter value: {some_parameter_value}")
pipes.log.info("Started computation")

# ... your code that computes and persists the asset

Expand All @@ -63,7 +63,7 @@ with open_dagster_pipes() as pipes:
# multi-assets you can pass an `asset_key` parameter.
pipes.report_asset_materialization(
metadata={
"some_metric": {"raw_value": some_parameter_value + 1, "type": "int"}
"some_metric": {"raw_value": 1, "type": "int"}
},
data_version="alpha",
)
Expand All @@ -88,15 +88,17 @@ Next, you'll package the script into a container image using a `Dockerfile`. For
```dockerfile
FROM python:3.10-slim

pip install dagster-pipes
RUN pip install dagster-pipes

COPY my_python_script.py .

ENTRYPOINT [ "python","my_python_script.py" ]
```

Then, build the image:

```shell
docker build -t pipes-example:v1
docker build -t pipes-example:v1 .
```

**Note**: Depending on the Kubernetes setup you're using, you may need to upload the container image to a registry or otherwise make it available to the cluster. For example: `kind load docker-image pipes-example:v1`
Expand Down Expand Up @@ -193,7 +195,7 @@ from dagster_k8s import PipesK8sClient
def k8s_pipes_asset(context: AssetExecutionContext, k8s_pipes_client: PipesK8sClient):
return k8s_pipes_client.run(
context=context,
image="pipes-materialize:v1",
image="pipes-example:v1",
).get_materialize_result()


Expand Down

1 comment on commit 0a93b7e

@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-4eb2dxsky-elementl.vercel.app
https://master.dagster.dagster-docs.io

Built with commit 0a93b7e.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.