Skip to content

Commit d5ee1b8

Browse files
authored
Cherry-picks for 4.2.1 release (opendatahub-io#109)
* Extract common code to dedicated GitHub actions and fail the build if the lock file is not up-to-date Signed-off-by: Guilherme Caponetto <[email protected]> * Improve tag resolution on the Build notebook images step (opendatahub-io#83) * Suppress flake8 F824 warning to fix the CI Signed-off-by: Guilherme Caponetto <[email protected]> * Update JL version compatibility (opendatahub-io#108) * Fix disable cache mechanism (opendatahub-io#106) * Fix disable cache mechanism * Add tests for disable_node_caching * Add a check to run conda env remove only if the env exists * Remove unneeded file after series of cherry-picks * Reuse common actions in the release and update-version workflows --------- Signed-off-by: Guilherme Caponetto <[email protected]>
1 parent 288cc95 commit d5ee1b8

File tree

12 files changed

+204
-49
lines changed

12 files changed

+204
-49
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "Install UI dependencies"
2+
description: "Install UI dependencies; fail the build if the lock file is not up-to-date"
3+
4+
inputs:
5+
working_dir:
6+
description: "Elyra path"
7+
required: false
8+
default: "."
9+
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Go to working directory
14+
shell: bash
15+
run: |
16+
echo "Step: Go to working directory"
17+
cd ${{ inputs.working_dir }}
18+
- name: Install dependencies
19+
shell: bash
20+
run: |
21+
echo "Step: Install dependencies"
22+
make yarn-install
23+
- name: "Check yarn.lock"
24+
shell: bash
25+
run: |
26+
echo "Step: Check yarn.lock"
27+
git diff yarn.lock;
28+
[ "0" == "$(git diff yarn.lock | wc -l | tr -d ' ')" ]
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: "Install Yarn"
2+
description: "Install Yarn"
3+
4+
inputs:
5+
working_dir:
6+
description: "Elyra path"
7+
required: false
8+
default: "."
9+
version:
10+
description: "Yarn version"
11+
required: true
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: Go to working directory
17+
shell: bash
18+
run: |
19+
echo "Step: Go to working directory"
20+
cd ${{ inputs.working_dir }}
21+
- name: Install
22+
shell: bash
23+
run: |
24+
echo "Step: Install"
25+
corepack prepare yarn@${{ inputs.version }} --activate
26+
yarn set version ${{ inputs.version }}
27+
echo "Yarn version: $(yarn --version)"

.github/workflows/build.yml

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,11 @@ jobs:
4646
/home/runner/.cache/Cypress
4747
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
4848
- name: Install Yarn ${{ env.YARN_VERSION }}
49-
run: |
50-
corepack prepare yarn@${{ env.YARN_VERSION }} --activate
51-
yarn set version ${{ env.YARN_VERSION }}
52-
yarn --version
53-
- name: Install dependencies
54-
run: |
55-
yarn install
49+
uses: ./.github/actions/install-yarn
50+
with:
51+
version: ${{ env.YARN_VERSION }}
52+
- name: Install UI dependencies
53+
uses: ./.github/actions/install-ui-dependencies
5654
lint-server:
5755
name: Lint Server
5856
runs-on: ubuntu-latest
@@ -81,13 +79,11 @@ jobs:
8179
*/*/node_modules
8280
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
8381
- name: Install Yarn ${{ env.YARN_VERSION }}
84-
run: |
85-
corepack prepare yarn@${{ env.YARN_VERSION }} --activate
86-
yarn set version ${{ env.YARN_VERSION }}
87-
yarn --version
88-
- name: Install dependencies
89-
run: |
90-
make yarn-install
82+
uses: ./.github/actions/install-yarn
83+
with:
84+
version: ${{ env.YARN_VERSION }}
85+
- name: Install UI dependencies
86+
uses: ./.github/actions/install-ui-dependencies
9187
- name: Lint
9288
run: make eslint-check-ui
9389
- name: Check format
@@ -141,14 +137,14 @@ jobs:
141137
*/*/node_modules
142138
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
143139
- name: Install Yarn ${{ env.YARN_VERSION }}
144-
run: |
145-
corepack prepare yarn@${{ env.YARN_VERSION }} --activate
146-
yarn set version ${{ env.YARN_VERSION }}
147-
yarn --version
140+
uses: ./.github/actions/install-yarn
141+
with:
142+
version: ${{ env.YARN_VERSION }}
143+
- name: Install UI dependencies
144+
uses: ./.github/actions/install-ui-dependencies
148145
- name: Build
149146
run: |
150147
make build-dependencies
151-
make yarn-install
152148
make build-ui-prod
153149
- name: Install
154150
run: make install-server
@@ -175,14 +171,14 @@ jobs:
175171
/home/runner/.cache/Cypress
176172
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
177173
- name: Install Yarn ${{ env.YARN_VERSION }}
178-
run: |
179-
corepack prepare yarn@${{ env.YARN_VERSION }} --activate
180-
yarn set version ${{ env.YARN_VERSION }}
181-
yarn --version
174+
uses: ./.github/actions/install-yarn
175+
with:
176+
version: ${{ env.YARN_VERSION }}
177+
- name: Install UI dependencies
178+
uses: ./.github/actions/install-ui-dependencies
182179
- name: Build
183180
run: |
184181
make build-dependencies
185-
make yarn-install
186182
make build-ui-prod
187183
- name: Install
188184
run: |
@@ -254,10 +250,9 @@ jobs:
254250
/home/runner/.cache/Cypress
255251
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
256252
- name: Install Yarn ${{ env.YARN_VERSION }}
257-
run: |
258-
corepack prepare yarn@${{ env.YARN_VERSION }} --activate
259-
yarn set version ${{ env.YARN_VERSION }}
260-
yarn --version
253+
uses: ./.github/actions/install-yarn
254+
with:
255+
version: ${{ env.YARN_VERSION }}
261256
- name: Check whether to build container images
262257
id: should-build-images
263258
run: |
@@ -266,6 +261,8 @@ jobs:
266261
if: steps.should-build-images.outputs.result == 'true'
267262
run: |
268263
./.github/workflows/scripts/free_gha_space.sh
264+
- name: Install UI dependencies
265+
uses: ./.github/actions/install-ui-dependencies
269266
- name: Build
270267
run: |
271268
make install-prod
@@ -289,9 +286,7 @@ jobs:
289286
290287
URLS=""
291288
for tag_prefix in $(echo "${{ env.QUAY_WORKBENCH_IMAGES_TAG_PREFIX_CSV }}" | tr ',' '\n'); do
292-
LATEST_TAG=$(curl -s "https://quay.io/api/v1/repository/${{ env.QUAY_WORKBENCH_IMAGES_REPOSITORY}}/tag/?onlyActiveTags=true" | \
293-
jq -r ".tags | map(select(.name | startswith(\"${tag_prefix}\"))) | .[].name" | \
294-
sort -r | head -n 1)
289+
LATEST_TAG=$(curl -s "https://quay.io/api/v1/repository/${{ env.QUAY_WORKBENCH_IMAGES_REPOSITORY}}/tag/?onlyActiveTags=true&filter_tag_name=like:${tag_prefix}&limit=1" | jq -r ".tags[].name")
295290
echo "Latest tag: $LATEST_TAG"
296291
297292
CONTAINER_IMAGE=ghcr.io/${{ github.repository }}/workbench-images:${LATEST_TAG}${TAG_SUFFIX}

.github/workflows/release.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,11 @@ jobs:
6464
with:
6565
node-version: ${{ env.NODE_VERSION }}
6666
- name: Install Yarn ${{ env.YARN_VERSION }}
67-
run: |
68-
corepack prepare yarn@${{ env.YARN_VERSION }} --activate
69-
yarn set version ${{ env.YARN_VERSION }}
70-
yarn --version
67+
uses: ./.github/actions/install-yarn
68+
with:
69+
version: ${{ env.YARN_VERSION }}
70+
- name: Install UI dependencies
71+
uses: ./.github/actions/install-ui-dependencies
7172
- name: Check version
7273
if: ${{ github.repository_owner == 'opendatahub-io' && (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && !inputs.dry_run)) }}
7374
run: |

.github/workflows/update-version-through-pr.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,12 @@ jobs:
4141
node-version: ${{ env.NODE_VERSION }}
4242

4343
- name: Install Yarn ${{ env.YARN_VERSION }}
44-
run: |
45-
corepack prepare yarn@${{ env.YARN_VERSION }} --activate
46-
yarn set version ${{ env.YARN_VERSION }}
47-
git checkout package.json
48-
yarn --version
44+
uses: ./.github/actions/install-yarn
45+
with:
46+
version: ${{ env.YARN_VERSION }}
4947

50-
- name: Install dependencies
51-
run: |
52-
make yarn-install
48+
- name: Install UI dependencies
49+
uses: ./.github/actions/install-ui-dependencies
5350

5451
- name: Update version to ${{ github.event.inputs.version }}
5552
id: update

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@ release: yarn-install build-ui-prod build-server ## Build wheel file for release
198198

199199

200200
elyra-image-env: ## Creates a conda env consisting of the dependencies used in images
201-
conda env remove -y -n $(ELYRA_IMAGE_ENV)
201+
@conda env list | grep -q "$(ELYRA_IMAGE_ENV)" && \
202+
conda env remove -y -n $(ELYRA_IMAGE_ENV) || \
203+
echo "Environment $(ELYRA_IMAGE_ENV) does not exist, skipping removal"
202204
conda create -y -n $(ELYRA_IMAGE_ENV) python=$(PYTHON_VERSION) --channel conda-forge
203205
$(CONDA_ACTIVATE) $(ELYRA_IMAGE_ENV) && \
204206
$(PYTHON_PIP) install -r etc/generic/requirements-elyra.txt && \

elyra/kfp/bootstrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ def log_operation_info(cls, action_clause: str, duration_secs: Optional[float] =
735735
:param action_clause: str representing the action that is being logged
736736
:param duration_secs: optional float value representing the duration of the action being logged
737737
"""
738-
global pipeline_name, operation_name
738+
global pipeline_name, operation_name # noqa: F824
739739
if enable_pipeline_info:
740740
duration_clause = f"({duration_secs:.3f} secs)" if duration_secs else ""
741741
logger.info(f"'{pipeline_name}':'{operation_name}' - {action_clause} {duration_clause}")

elyra/pipeline/kfp/processor_kfp.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,10 @@ def _generate_workflow_tasks(
886886
# Use Kubeflow Pipelines provided RUN_ID_PLACEHOLDER as run name
887887
workflow_task["task_modifiers"]["set_run_name"] = RUN_ID_PLACEHOLDER
888888

889+
disable_node_caching = pipeline.pipeline_properties.get(pipeline_constants.DISABLE_NODE_CACHING)
890+
if disable_node_caching:
891+
workflow_task["task_modifiers"]["disable_node_caching"] = disable_node_caching.selection
892+
889893
# Upload dependencies to cloud storage
890894
self._upload_dependencies_to_object_store(
891895
runtime_configuration, pipeline_name, operation, prefix=artifact_object_prefix

elyra/templates/kubeflow/v2/python_dsl_template.jinja2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def generated_pipeline(
9191
{{ task_name }}.set_env_variable(name="ELYRA_RUN_NAME", value="{{ workflow_task.task_modifiers.set_run_name }}")
9292
{% endif %}
9393
{% if workflow_task.task_modifiers.disable_node_caching %}
94-
{{ task_name }}.execution_options.caching_strategy.max_cache_staleness = "P0D"
94+
{{ task_name }}.set_caching_options(enable_caching={{ workflow_task.task_modifiers.disable_node_caching == false }})
9595
{% endif %}
9696
{% if workflow_task.task_modifiers.pod_labels %}
9797
{% for pod_label_key, pod_label_value in workflow_task.task_modifiers.pod_labels.items() %}

elyra/tests/pipeline/kfp/conftest.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from elyra.pipeline.kfp.processor_kfp import WorkflowEngineType
3333
from elyra.pipeline.parser import PipelineParser
3434
from elyra.pipeline.pipeline import Pipeline
35-
from elyra.pipeline.pipeline_constants import COS_OBJECT_PREFIX
35+
from elyra.pipeline.pipeline_constants import COS_OBJECT_PREFIX, DISABLE_NODE_CACHING
3636

3737

3838
@pytest.fixture()
@@ -158,6 +158,7 @@ def metadata_dependencies(metadata_managers, request):
158158
- "pipeline_file": existing pipeline filename
159159
Optional inputs:
160160
- "with_cos_object_prefix": bool (default: False)
161+
- "with_disable_node_caching": bool (default: False)
161162
- "workflow_engine": WorkflowEngineType.ARGO or WorkflowEngineType.TEKTON
162163
- "use_cos_credentials_secret": bool (default: False)
163164
- "require_pull_secret": bool (default: False)
@@ -179,6 +180,7 @@ def metadata_dependencies(metadata_managers, request):
179180
customization_options = {}
180181
for supported_option in [
181182
"with_cos_object_prefix",
183+
"with_disable_node_caching",
182184
"resources_cpu",
183185
"resources_cpu_limit",
184186
"resources_gpu",
@@ -365,6 +367,7 @@ def get_pipeline_object(
365367
Creates a KFP Pipeline instance from pipeline_filename, taking into account the
366368
following optional customization options:
367369
- "with_cos_object_prefix" (True/False)
370+
- "with_disable_node_caching" (True/False)
368371
- "resources_cpu" (number, applied to all generic nodes)
369372
- "resources_gpu" (number, applied to all generic nodes)
370373
- "resources_memory" (number, applied to all generic nodes)
@@ -410,6 +413,9 @@ def get_pipeline_object(
410413
if app_data["properties"].get("pipeline_defaults") is not None:
411414
app_data["properties"]["pipeline_defaults"].pop(COS_OBJECT_PREFIX, None)
412415

416+
if customization_options.get("with_disable_node_caching"):
417+
app_data["properties"]["pipeline_defaults"][DISABLE_NODE_CACHING] = True
418+
413419
#
414420
# Add resource customizations to every generic node
415421
for node in primary_pipeline["nodes"]:

0 commit comments

Comments
 (0)