Skip to content

Commit

Permalink
SDK - DSL - Deprecated ArtifactLocation (#2326)
Browse files Browse the repository at this point in the history
* SDK - DSL - Deprecated the per-task artifact_location

* Removed artifact_location from the docstring

* Deprecated ArtifactLocation
  • Loading branch information
Ark-kun authored and k8s-ci-robot committed Nov 6, 2019
1 parent f2516b7 commit d315bf6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 52 deletions.
2 changes: 2 additions & 0 deletions sdk/python/kfp/dsl/_artifact_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from typing import Dict, Union, Any

from argo.models import V1alpha1ArtifactLocation, V1alpha1S3Artifact, V1alpha1Artifact
from deprecated.sphinx import deprecated
from kubernetes.client.models import V1SecretKeySelector


Expand All @@ -26,6 +27,7 @@ def _dict_to_secret(
return value or V1SecretKeySelector(key="", optional=True)


@deprecated(version='0.1.32', reason='ArtifactLocation is deprecated since SDK v0.1.32. Please configure the artifact location in the cluster configMap: https://github.com/argoproj/argo/blob/master/ARTIFACT_REPO.md#configure-the-default-artifact-repository .')
class ArtifactLocation:
"""
ArtifactLocation describes a location for a single or multiple artifacts.
Expand Down
16 changes: 5 additions & 11 deletions sdk/python/kfp/dsl/_container_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -928,14 +928,6 @@ class ContainerOp(BaseOp):
description='hello world')
def foo_pipeline(tag: str, pull_image_policy: str):
# configures artifact location
artifact_location = dsl.ArtifactLocation.s3(
bucket="foobar",
endpoint="minio-service:9000",
insecure=True,
access_key_secret=V1SecretKeySelector(name="minio", key="accesskey"),
secret_key_secret=V1SecretKeySelector(name="minio", key="secretkey"))
# any attributes can be parameterized (both serialized string or actual PipelineParam)
op = dsl.ContainerOp(name='foo',
image='busybox:%s' % tag,
Expand All @@ -945,8 +937,7 @@ def foo_pipeline(tag: str, pull_image_policy: str):
sidecars=[dsl.Sidecar('print', 'busybox:latest', command='echo "hello"')],
# pass in k8s container kwargs
container_kwargs={'env': [V1EnvVar('foo', 'bar')]},
# configures artifact location
artifact_location=artifact_location)
)
# set `imagePullPolicy` property for `container` with `PipelineParam`
op.container.set_pull_image_policy(pull_image_policy)
Expand Down Expand Up @@ -1006,7 +997,7 @@ def __init__(
It has the following default artifact paths during compile time.
{'mlpipeline-ui-metadata': '/mlpipeline-ui-metadata.json',
'mlpipeline-metrics': '/mlpipeline-metrics.json'}
artifact_location: configures the default artifact location for artifacts
artifact_location: Deprecated. Configures the default artifact location for artifacts
in the argo workflow template. Must be a `V1alpha1ArtifactLocation`
object.
is_exit_handler: Deprecated. This is no longer needed.
Expand Down Expand Up @@ -1093,6 +1084,9 @@ def _decorated(*args, **kwargs):
self.output_artifact_paths = output_artifact_paths or {}
self.artifact_location = artifact_location

if artifact_location:
warnings.warn('Setting per-ContainerOp artifact_location is deprecated since SDK v0.1.32. Please configure the artifact location in the cluster configMap: https://github.com/argoproj/argo/blob/master/ARTIFACT_REPO.md#configure-the-default-artifact-repository . For short-term workaround use the pipeline-wide kfp.dsl.PipelineConf().set_artifact_location, but it can also be deprecated in future.', PendingDeprecationWarning)

self._metadata = None

self.outputs = {}
Expand Down
11 changes: 1 addition & 10 deletions sdk/python/tests/compiler/testdata/artifact_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def foo_pipeline(tag: str, namespace: str = "kubeflow", bucket: str = "foobar"):
secret_key_secret=V1SecretKeySelector(name="minio", key="secretkey"))

# configures artifact location using AWS IAM role (no access key provided)
artifact_location = dsl.ArtifactLocation.s3(
aws_artifact_location = dsl.ArtifactLocation.s3(
bucket=bucket,
endpoint="s3.amazonaws.com",
region="ap-southeast-1",
Expand All @@ -45,12 +45,3 @@ def foo_pipeline(tag: str, namespace: str = "kubeflow", bucket: str = "foobar"):
'out_art': '/tmp/out_art.txt',
},
)

# op level artifact location (to s3 bucket)
op2 = dsl.ContainerOp(name='foo',
image='busybox:%s' % tag,
output_artifact_paths={
'out_art': '/tmp/out_art.txt',
},
# configures artifact location
artifact_location=artifact_location)
31 changes: 0 additions & 31 deletions sdk/python/tests/compiler/testdata/artifact_location.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@ spec:
value: '{{inputs.parameters.tag}}'
name: foo
template: foo
- arguments:
parameters:
- name: bucket
value: '{{inputs.parameters.bucket}}'
- name: tag
value: '{{inputs.parameters.tag}}'
name: foo-2
template: foo-2
inputs:
parameters:
- name: bucket
Expand Down Expand Up @@ -77,26 +69,3 @@ spec:
secretKeySecret:
key: 'secretkey'
name: 'minio'
- container:
image: busybox:{{inputs.parameters.tag}}
inputs:
parameters:
- name: bucket
- name: tag
name: foo-2
outputs:
artifacts:
- name: out_art
path: /tmp/out_art.txt
s3:
accessKeySecret:
key: ''
optional: true
bucket: '{{inputs.parameters.bucket}}'
endpoint: s3.amazonaws.com
insecure: false
key: runs/{{workflow.uid}}/{{pod.name}}/out_art.tgz
region: ap-southeast-1
secretKeySecret:
key: ''
optional: true

0 comments on commit d315bf6

Please sign in to comment.