From 3c92d12ce6925c0b169c469c6f028b3c6b56c72f Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Mon, 16 Oct 2023 18:02:42 -0700 Subject: [PATCH] Add integration tests Signed-off-by: Kevin Su --- .github/workflows/checks.yml | 6 +-- .github/workflows/docs_build.yml | 6 +-- .github/workflows/end2end.yml | 38 +++++++++++++++++++ examples/integration_test.py | 37 ++++++++++++++++++ examples/ray_plugin/ray_plugin/ray_example.py | 2 +- 5 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/end2end.yml create mode 100644 examples/integration_test.py diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 81b8840f3..625506676 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -6,9 +6,9 @@ on: - master paths-ignore: - "docs/**" - pull_request: - paths-ignore: - - "docs/**" +# pull_request: +# paths-ignore: +# - "docs/**" jobs: lint: runs-on: ubuntu-latest diff --git a/.github/workflows/docs_build.yml b/.github/workflows/docs_build.yml index cc418bc1e..c121d9c43 100644 --- a/.github/workflows/docs_build.yml +++ b/.github/workflows/docs_build.yml @@ -4,9 +4,9 @@ on: push: branches: - master - pull_request: - branches: - - master +# pull_request: +# branches: +# - master jobs: docs_warnings: name: Docs Warnings diff --git a/.github/workflows/end2end.yml b/.github/workflows/end2end.yml new file mode 100644 index 000000000..e85aef2a7 --- /dev/null +++ b/.github/workflows/end2end.yml @@ -0,0 +1,38 @@ +name: End to End tests + +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + endtoend: + name: End to End tests + runs-on: ubuntu-latest + env: + FLYTESNACKS_VERSION: "" + steps: + - name: Checkout + uses: actions/checkout@v3 + - uses: unionai/flytectl-setup-action@v0.0.1 + name: Setup flytectl + - uses: actions/setup-python@v3 + with: + python-version: 3.10 + - name: Create Sandbox Cluster + run: | + flytectl config init + flytectl demo start + kubectl create -k "github.com/ray-project/kuberay/ray-operator/config/default?ref=v0.5.2" + kubectl rollout restart deployment flyte-sandbox -n flyte + - name: Setup Flytekit + run: | + python -m pip install --upgrade pip + pip install flytekit flytekitplugins-deck-standard flytekitplugins-ray + pip freeze + - name: execute flyte workflows + working-directory: examples + run: | + pyflyte run --remote integration_test.py integration_test diff --git a/examples/integration_test.py b/examples/integration_test.py new file mode 100644 index 000000000..a94a382d9 --- /dev/null +++ b/examples/integration_test.py @@ -0,0 +1,37 @@ +from basics.basics.documenting_workflows import google_docstring_wf, numpy_docstring_wf, sphinx_docstring_wf +from basics.basics.hello_world import hello_world_wf +from basics.basics.imperative_workflow import imperative_wf +from basics.basics.launch_plan import simple_wf_lp_fixed_inputs +from basics.basics.named_outputs import simple_wf_with_named_outputs +from basics.basics.shell_task import shell_task_wf +from basics.basics.task import slope +from basics.basics.workflow import simple_wf_with_partial +from ray_plugin.ray_plugin.ray_example import ray_workflow +from flytekit import workflow, task + + +@workflow +def integration_test(): + # Test Basic Workflows + google_docstring_wf() + numpy_docstring_wf() + sphinx_docstring_wf() + + hello_world_wf() + imperative_wf(x=[-3, 0, 3], y=[7, 4, -2]) + + simple_wf_lp_fixed_inputs(y=[-3, 2, -2]) + simple_wf_with_named_outputs() + + shell_task_wf() + slope(x=[-3, 0, 3], y=[7, 4, -2]) + simple_wf_with_partial(x=[-3, 0, 3], y=[7, 4, -2]) + + # Test Plugins + ray_workflow(n=5) + + # TODO: Add more plugins here, like spark, tensorflow, torch, Dask. + + +if __name__ == '__main__': + integration_test() diff --git a/examples/ray_plugin/ray_plugin/ray_example.py b/examples/ray_plugin/ray_plugin/ray_example.py index 9f3a2fc41..95687e6fc 100644 --- a/examples/ray_plugin/ray_plugin/ray_example.py +++ b/examples/ray_plugin/ray_plugin/ray_example.py @@ -84,7 +84,7 @@ def f(x): # %% @task( task_config=ray_config, - requests=Resources(mem="2Gi", cpu="2"), + requests=Resources(mem="800Mi", cpu="1"), container_image=custom_image, ) def ray_task(n: int) -> typing.List[int]: