Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kubernetes Tasks #779

Merged
merged 25 commits into from
Mar 21, 2019
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7308948
Task files for jobs, pods, services, and deployments
joshmeek Mar 19, 2019
1e043fa
Working CreateNamespacedJobTask
joshmeek Mar 21, 2019
2a10439
Remove Task on naming convention
joshmeek Mar 21, 2019
57e1b48
Tests for CreateNamespacedJob
joshmeek Mar 21, 2019
f2c1d75
Import merge conflict
joshmeek Mar 21, 2019
3bd77d0
CreateNamespacedJob documentation
joshmeek Mar 21, 2019
c8f9cf0
Tasks for NamespacedJob: Create, Delete, List, Patch, Read, Replace
joshmeek Mar 21, 2019
c853c3a
Added tests for Kubernetes job tasks
joshmeek Mar 21, 2019
2a6b47c
Update job tests with mocking
joshmeek Mar 21, 2019
b7e8eb1
Added Kubernetes Deployment tasks and relevant tests
joshmeek Mar 21, 2019
3a870f3
Added Kubernetes Pod tasks and relevant tests
joshmeek Mar 21, 2019
75f2f51
Added Kubernetes Service tasks and relevant tests
joshmeek Mar 21, 2019
aec455c
Add kubernetes tasks to docs
joshmeek Mar 21, 2019
86712f0
Adjusted Kubernetes tasks in docs
joshmeek Mar 21, 2019
4a955c5
Update CHANGELOG
joshmeek Mar 21, 2019
d4f522b
Merge branch 'master' into kube_tasks
joshmeek Mar 21, 2019
ffcf6d6
Add pytest importskip for kubernetes on tests
joshmeek Mar 21, 2019
407aaa1
Merge branch 'master' into kube_tasks
joshmeek Mar 21, 2019
04bf42f
Merge branch 'master' into kube_tasks
joshmeek Mar 21, 2019
76d4349
Merge remote-tracking branch 'origin/task-library-docs' into kube_tasks
joshmeek Mar 21, 2019
56d84aa
Added task library documentation for Kubernetes tasks
joshmeek Mar 21, 2019
4623c0d
Merge branch 'master' into kube_tasks
joshmeek Mar 21, 2019
366db17
Removed use of self.client in Kubernetes tasks
joshmeek Mar 21, 2019
fd368cb
Kubernetes task docstring tweaks for inline code
joshmeek Mar 21, 2019
e07d89b
Added Raises information to Kubernetes task docstrings
joshmeek Mar 21, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,11 @@ These changes are available in the [master branch](https://github.com/PrefectHQ/
- Add `checkpoint` option for individual `Task`s, as well as a global `checkpoint` config setting for storing the results of Tasks using their result handlers - [#649](https://github.com/PrefectHQ/prefect/pull/649)
- Add `defaults_from_attrs` decorator to easily construct `Task`s whose attributes serve as defaults for `Task.run` - [#293](https://github.com/PrefectHQ/prefect/issues/293)
- Environments follow new hierarchy (PIN-3) - [#670](https://github.com/PrefectHQ/prefect/pull/670)
- Add `GCSUploadTask` and `GCSDownloadTask` for uploading / retrieving string data to / from Google Cloud Storage - [#673](https://github.com/PrefectHQ/prefect/pull/673)
- Add `BigQueryTask` and `BigQueryInsertTask` for executing queries against BigQuery tables and inserting data - [#678](https://github.com/PrefectHQ/prefect/pull/678), [#685](https://github.com/PrefectHQ/prefect/pull/685)
- Add `OneTimeSchedule` for one-time execution at a specified time - [#680](https://github.com/PrefectHQ/prefect/pull/680)
- Add `FilterTask` for filtering out lists of results - [#637](https://github.com/PrefectHQ/prefect/issues/637)
- Add `S3DownloadTask` and `S3UploadTask` for interacting with data stored on AWS S3 - [#692](https://github.com/PrefectHQ/prefect/issues/692)
- `flow.run` is now a blocking call which will run the Flow, on its schedule, and execute full state-based execution (including retries) - [#690](https://github.com/PrefectHQ/prefect/issues/690)
- Pre-populate `prefect.context` with various formatted date strings during execution - [#704](https://github.com/PrefectHQ/prefect/pull/704)
- Add `AirflowTask` and `AirflowTriggerDAG` tasks to the task library for running individual Airflow tasks / DAGs - [#735](https://github.com/PrefectHQ/prefect/issues/735)
- Add ability to overwrite task attributes such as "name" when calling tasks in the functional API - [#717](https://github.com/PrefectHQ/prefect/issues/717)
- Release Prefect Core under the Apache 2.0 license - [#762](https://github.com/PrefectHQ/prefect/pull/762)
- Add `OpenGitHubIssue` and `CreateGitHubPR` tasks for interacting with GitHub repositories - [#771](https://github.com/PrefectHQ/prefect/pull/771)

### Enhancements

Expand Down Expand Up @@ -50,6 +44,16 @@ These changes are available in the [master branch](https://github.com/PrefectHQ/
- Add `idempotency_key` and `context` arguments to `Client.create_flow_run` - [#757](https://github.com/PrefectHQ/prefect/issues/757)
- Make `EmailTask` more secure by pulling credentials from secrets - [#706](https://github.com/PrefectHQ/prefect/issues/706)

### Task Library

- Add `GCSUploadTask` and `GCSDownloadTask` for uploading / retrieving string data to / from Google Cloud Storage - [#673](https://github.com/PrefectHQ/prefect/pull/673)
- Add `BigQueryTask` and `BigQueryInsertTask` for executing queries against BigQuery tables and inserting data - [#678](https://github.com/PrefectHQ/prefect/pull/678), [#685](https://github.com/PrefectHQ/prefect/pull/685)
- Add `FilterTask` for filtering out lists of results - [#637](https://github.com/PrefectHQ/prefect/issues/637)
- Add `S3DownloadTask` and `S3UploadTask` for interacting with data stored on AWS S3 - [#692](https://github.com/PrefectHQ/prefect/issues/692)
- Add `AirflowTask` and `AirflowTriggerDAG` tasks to the task library for running individual Airflow tasks / DAGs - [#735](https://github.com/PrefectHQ/prefect/issues/735)
- Add `OpenGitHubIssue` and `CreateGitHubPR` tasks for interacting with GitHub repositories - [#771](https://github.com/PrefectHQ/prefect/pull/771)
- Add Kubernetes tasks for deployments, jobs, pods, and services - [#779](https://github.com/PrefectHQ/prefect/pull/779)

### Fixes

- Fix edge case in doc generation in which some `Exception`s' call signature could not be inspected - [#513](https://github.com/PrefectHQ/prefect/issues/513)
Expand Down
2 changes: 2 additions & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ module.exports = {
'tasks/function',
'tasks/github',
'tasks/google',
'tasks/kubernetes',
'tasks/notifications',
'tasks/shell',
'tasks/sqlite',
Expand Down Expand Up @@ -153,6 +154,7 @@ module.exports = {
'task_library/function',
'task_library/github',
'task_library/google',
'task_library/kubernetes',
'task_library/notifications',
'task_library/shell',
'task_library/sqlite',
Expand Down
1 change: 1 addition & 0 deletions docs/guide/development/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ It's important to update Prefect's [changelog](/api/changelog.html) with any adj

- Features: headline additions to the system
- Enhancements: improvements to existing functionality, or minor additions
- Task Library: additions to Prefect's task library
- Fixes: adjustments that fix bugs or other conditions
- Breaking Changes: any changes that break Prefect's backwards-compatibility

Expand Down
160 changes: 160 additions & 0 deletions docs/guide/task_library/kubernetes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
---
title: Kubernetes
---

# Kubernetes

## Deployments

### CreateNamespacedDeployment <Badge text="task"/>

Task for creating a namespaced deployment on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-createnamespaceddeployment)

### DeleteNamespacedDeployment <Badge text="task"/>

Task for deleting a namespaced deployment on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-deletenamespaceddeployment)

### ListNamespacedDeployment <Badge text="task"/>

Task for listing a namespaced deployment on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-listnamespaceddeployment)

### PatchNamespacedDeployment <Badge text="task"/>

Task for patching a namespaced deployment on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-patchnamespaceddeployment)

### ReadNamespacedDeployment <Badge text="task"/>

Task for reading a namespaced deployment on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-readnamespaceddeployment)

### ReplaceNamespacedDeployment <Badge text="task"/>

Task for replacing a namespaced deployment on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-replacenamespaceddeployment)


## Jobs

### CreateNamespacedJob <Badge text="task"/>

Task for creating a namespaced job on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-createnamespacedjob)

### DeleteNamespacedJob <Badge text="task"/>

Task for deleting a namespaced job on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-deletenamespacedjob)

### ListNamespacedJob <Badge text="task"/>

Task for listing a namespaced job on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-listnamespacedjob)

### PatchNamespacedJob <Badge text="task"/>

Task for patching a namespaced job on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-patchnamespacedjob)

### ReadNamespacedJob <Badge text="task"/>

Task for reading a namespaced job on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-readnamespacedjob)

### ReplaceNamespacedJob <Badge text="task"/>

Task for replacing a namespaced job on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-replacenamespacedjob)


## Pods

### CreateNamespacedPod <Badge text="task"/>

Task for creating a namespaced pod on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-createnamespacedpod)

### DeleteNamespacedPod <Badge text="task"/>

Task for deleting a namespaced pod on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-deletenamespacedpod)

### ListNamespacedPod <Badge text="task"/>

Task for listing a namespaced pod on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-listnamespacedpod)

### PatchNamespacedPod <Badge text="task"/>

Task for patching a namespaced pod on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-patchnamespacedpod)

### ReadNamespacedPod <Badge text="task"/>

Task for reading a namespaced pod on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-readnamespacedpod)

### ReplaceNamespacedPod <Badge text="task"/>

Task for replacing a namespaced pod on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-replacenamespacedpod)


## Services

### CreateNamespacedService <Badge text="task"/>

Task for creating a namespaced service on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-createnamespacedservice)

### DeleteNamespacedService <Badge text="task"/>

Task for deleting a namespaced service on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-deletenamespacedservice)

### ListNamespacedService <Badge text="task"/>

Task for listing a namespaced service on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-listnamespacedservice)

### PatchNamespacedService <Badge text="task"/>

Task for patching a namespaced service on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-patchnamespacedservice)

### ReadNamespacedService <Badge text="task"/>

Task for reading a namespaced service on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-readnamespacedservice)

### ReplaceNamespacedService <Badge text="task"/>

Task for replacing a namespaced service on Kubernetes.

[API Reference](/api/tasks/kubernetes.html#prefect-tasks-kubernetes-replacenamespacedservice)
10 changes: 10 additions & 0 deletions docs/outline.toml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ title = "GitHub Tasks"
module = "prefect.tasks.github"
classes = ["CreateGitHubPR", "OpenGitHubIssue"]

[pages.tasks.kubernetes]
title = "Kubernetes Tasks"
module = "prefect.tasks.kubernetes"
classes = [
"CreateNamespacedDeployment", "DeleteNamespacedDeployment", "ListNamespacedDeployment", "PatchNamespacedDeployment", "ReadNamespacedDeployment", "ReplaceNamespacedDeployment",
"CreateNamespacedJob", "DeleteNamespacedJob", "ListNamespacedJob", "PatchNamespacedJob", "ReadNamespacedJob", "ReplaceNamespacedJob",
"CreateNamespacedPod", "DeleteNamespacedPod", "ListNamespacedPod", "PatchNamespacedPod", "ReadNamespacedPod", "ReplaceNamespacedPod",
"CreateNamespacedService", "DeleteNamespacedService", "ListNamespacedService", "PatchNamespacedService", "ReadNamespacedService", "ReplaceNamespacedService"
]

[pages.tasks.google]
title = "Google Cloud Tasks"
module = "prefect.tasks.google"
Expand Down
5 changes: 5 additions & 0 deletions src/prefect/tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
except ImportError:
pass

try:
import prefect.tasks.kubernetes
except ImportError:
pass

try:
import prefect.tasks.templates
except ImportError:
Expand Down
32 changes: 32 additions & 0 deletions src/prefect/tasks/kubernetes/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from prefect.tasks.kubernetes.deployment import (
CreateNamespacedDeployment,
DeleteNamespacedDeployment,
ListNamespacedDeployment,
PatchNamespacedDeployment,
ReadNamespacedDeployment,
ReplaceNamespacedDeployment,
)
from prefect.tasks.kubernetes.job import (
CreateNamespacedJob,
DeleteNamespacedJob,
ListNamespacedJob,
PatchNamespacedJob,
ReadNamespacedJob,
ReplaceNamespacedJob,
)
from prefect.tasks.kubernetes.pod import (
CreateNamespacedPod,
DeleteNamespacedPod,
ListNamespacedPod,
PatchNamespacedPod,
ReadNamespacedPod,
ReplaceNamespacedPod,
)
from prefect.tasks.kubernetes.service import (
CreateNamespacedService,
DeleteNamespacedService,
ListNamespacedService,
PatchNamespacedService,
ReadNamespacedService,
ReplaceNamespacedService,
)
Loading