Skip to content

Commit

Permalink
Update the samples of big data since the design changed (kubeflow#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
fenglixa authored Jul 6, 2020
1 parent 81335e4 commit 3f676af
Show file tree
Hide file tree
Showing 10 changed files with 1,007 additions and 1,378 deletions.
186 changes: 67 additions & 119 deletions samples/big_data_passing/big_data_passing_description.ipynb

Large diffs are not rendered by default.

71 changes: 28 additions & 43 deletions samples/big_data_passing/constant_to_consumer_pipeline.yaml
Original file line number Diff line number Diff line change
@@ -1,52 +1,37 @@
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
annotations:
pipelines.kubeflow.org/component_spec: '{"description": "Print small text", "inputs":
[{"name": "text", "type": "String"}], "name": "Print small text"}'
name: print-small-text
spec:
steps:
- args:
- --text
- Hello world
command:
- python3
- -u
- -c
- "def print_small_text(text ):\n '''Print small text'''\n print(text)\n\
\nimport argparse\n_parser = argparse.ArgumentParser(prog='Print small text',\
\ description='Print small text')\n_parser.add_argument(\"--text\", dest=\"\
text\", type=str, required=True, default=argparse.SUPPRESS)\n_parsed_args =\
\ vars(_parser.parse_args())\n_output_files = _parsed_args.pop(\"_output_paths\"\
, [])\n\n_outputs = print_small_text(**_parsed_args)\n\n_output_serializers\
\ = [\n\n]\n\nimport os\nfor idx, output_file in enumerate(_output_files):\n\
\ try:\n os.makedirs(os.path.dirname(output_file))\n except OSError:\n\
\ pass\n with open(output_file, 'w') as f:\n f.write(_output_serializers[idx](_outputs[idx]))\n"
image: tensorflow/tensorflow:1.13.2-py3
name: main
---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
kind: PipelineRun
metadata:
annotations:
pipelines.kubeflow.org/pipeline_spec: '{"description": "Pipeline that passes small
constant string to to consumer", "name": "Constant to consumer pipeline"}'
sidecar.istio.io/inject: 'false'
name: constant-to-consumer-pipeline
spec:
tasks:
- name: print-small-text
taskRef:
name: print-small-text
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
annotation:
tekton.dev/input_artifacts: '{}'
tekton.dev/output_artifacts: '{}'
name: constant-to-consumer-pipeline-run
labels:
pipelines.kubeflow.org/pipeline-sdk-type: kfp
name: constant-to-consumer-pipeline
spec:
pipelineRef:
name: constant-to-consumer-pipeline
pipelineSpec:
tasks:
- name: print-small-text
taskSpec:
steps:
- args:
- --text
- Hello world
command:
- python3
- -u
- -c
- "def print_small_text(text ):\n '''Print small text'''\n print(text)\n\
\nimport argparse\n_parser = argparse.ArgumentParser(prog='Print small\
\ text', description='Print small text')\n_parser.add_argument(\"--text\"\
, dest=\"text\", type=str, required=True, default=argparse.SUPPRESS)\n\
_parsed_args = vars(_parser.parse_args())\n_output_files = _parsed_args.pop(\"\
_output_paths\", [])\n\n_outputs = print_small_text(**_parsed_args)\n\n\
_output_serializers = [\n\n]\n\nimport os\nfor idx, output_file in enumerate(_output_files):\n\
\ try:\n os.makedirs(os.path.dirname(output_file))\n except\
\ OSError:\n pass\n with open(output_file, 'w') as f:\n \
\ f.write(_output_serializers[idx](_outputs[idx]))\n"
image: tensorflow/tensorflow:1.13.2-py3
name: main
Original file line number Diff line number Diff line change
@@ -1,63 +1,48 @@
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
annotations:
pipelines.kubeflow.org/component_spec: '{"description": "Print small text", "inputs":
[{"name": "text", "type": "String"}], "name": "Print small text"}'
name: print-small-text
spec:
params:
- name: text
steps:
- args:
- --text
- $(inputs.params.text)
command:
- python3
- -u
- -c
- "def print_small_text(text ):\n '''Print small text'''\n print(text)\n\
\nimport argparse\n_parser = argparse.ArgumentParser(prog='Print small text',\
\ description='Print small text')\n_parser.add_argument(\"--text\", dest=\"\
text\", type=str, required=True, default=argparse.SUPPRESS)\n_parsed_args =\
\ vars(_parser.parse_args())\n_output_files = _parsed_args.pop(\"_output_paths\"\
, [])\n\n_outputs = print_small_text(**_parsed_args)\n\n_output_serializers\
\ = [\n\n]\n\nimport os\nfor idx, output_file in enumerate(_output_files):\n\
\ try:\n os.makedirs(os.path.dirname(output_file))\n except OSError:\n\
\ pass\n with open(output_file, 'w') as f:\n f.write(_output_serializers[idx](_outputs[idx]))\n"
image: tensorflow/tensorflow:1.13.2-py3
name: main
---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
kind: PipelineRun
metadata:
annotations:
pipelines.kubeflow.org/pipeline_spec: '{"description": "Pipeline that passes small
pipeline parameter string to to consumer", "inputs": [{"name": "text", "type":
"String"}], "name": "Pipeline parameter to consumer pipeline"}'
sidecar.istio.io/inject: 'false'
name: pipeline-parameter-to-consumer-pipeline
spec:
params:
- name: text
tasks:
- name: print-small-text
params:
- name: text
value: $(params.text)
taskRef:
name: print-small-text
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
annotation:
tekton.dev/input_artifacts: '{}'
tekton.dev/output_artifacts: '{}'
name: pipeline-parameter-to-consumer-pipeline-run
labels:
pipelines.kubeflow.org/pipeline-sdk-type: kfp
name: pipeline-parameter-to-consumer-pipeline
spec:
params:
- name: text
value: ''
pipelineRef:
name: pipeline-parameter-to-consumer-pipeline
pipelineSpec:
params:
- name: text
tasks:
- name: print-small-text
params:
- name: text
value: $(params.text)
taskSpec:
params:
- name: text
steps:
- args:
- --text
- $(inputs.params.text)
command:
- python3
- -u
- -c
- "def print_small_text(text ):\n '''Print small text'''\n print(text)\n\
\nimport argparse\n_parser = argparse.ArgumentParser(prog='Print small\
\ text', description='Print small text')\n_parser.add_argument(\"--text\"\
, dest=\"text\", type=str, required=True, default=argparse.SUPPRESS)\n\
_parsed_args = vars(_parser.parse_args())\n_output_files = _parsed_args.pop(\"\
_output_paths\", [])\n\n_outputs = print_small_text(**_parsed_args)\n\n\
_output_serializers = [\n\n]\n\nimport os\nfor idx, output_file in enumerate(_output_files):\n\
\ try:\n os.makedirs(os.path.dirname(output_file))\n except\
\ OSError:\n pass\n with open(output_file, 'w') as f:\n \
\ f.write(_output_serializers[idx](_outputs[idx]))\n"
image: tensorflow/tensorflow:1.13.2-py3
name: main
191 changes: 77 additions & 114 deletions samples/big_data_passing/print_repeating_lines_pipeline.yaml
Original file line number Diff line number Diff line change
@@ -1,126 +1,89 @@
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
annotations:
pipelines.kubeflow.org/component_spec: '{"description": "Repeat the line specified
number of times", "inputs": [{"name": "line", "type": "String"}, {"default":
"10", "name": "count", "optional": true, "type": "Integer"}], "name": "Repeat
line", "outputs": [{"name": "output_text", "type": "String"}]}'
name: repeat-line
spec:
steps:
- args:
- --line
- Hello
- --count
- '5000'
- --output-text
- $(workspaces.repeat-line.path)/repeat-line-output-text
command:
- python3
- -u
- -c
- "def _make_parent_dirs_and_return_path(file_path: str):\n import os\n \
\ os.makedirs(os.path.dirname(file_path), exist_ok=True)\n return file_path\n\
\ndef repeat_line(line , output_text_path , count = 10):\n '''Repeat the\
\ line specified number of times'''\n with open(output_text_path, 'w') as\
\ writer:\n for i in range(count):\n writer.write(line + '\\\
n')\n\nimport argparse\n_parser = argparse.ArgumentParser(prog='Repeat line',\
\ description='Repeat the line specified number of times')\n_parser.add_argument(\"\
--line\", dest=\"line\", type=str, required=True, default=argparse.SUPPRESS)\n\
_parser.add_argument(\"--count\", dest=\"count\", type=int, required=False,\
\ default=argparse.SUPPRESS)\n_parser.add_argument(\"--output-text\", dest=\"\
output_text_path\", type=_make_parent_dirs_and_return_path, required=True, default=argparse.SUPPRESS)\n\
_parsed_args = vars(_parser.parse_args())\n_output_files = _parsed_args.pop(\"\
_output_paths\", [])\n\n_outputs = repeat_line(**_parsed_args)\n\n_output_serializers\
\ = [\n\n]\n\nimport os\nfor idx, output_file in enumerate(_output_files):\n\
\ try:\n os.makedirs(os.path.dirname(output_file))\n except OSError:\n\
\ pass\n with open(output_file, 'w') as f:\n f.write(_output_serializers[idx](_outputs[idx]))\n"
image: tensorflow/tensorflow:1.13.2-py3
name: main
workspaces:
- name: repeat-line
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
annotations:
pipelines.kubeflow.org/component_spec: '{"description": "Print text", "inputs":
[{"name": "text"}], "name": "Print text"}'
name: print-text
spec:
steps:
- args:
- --text
- $(workspaces.print-text.path)/repeat-line-output-text
command:
- python3
- -u
- -c
- "def print_text(text_path ): # The \"text\" input is untyped so that any data\
\ can be printed\n '''Print text'''\n with open(text_path, 'r') as reader:\n\
\ for line in reader:\n print(line, end = '')\n\nimport argparse\n\
_parser = argparse.ArgumentParser(prog='Print text', description='Print text')\n\
_parser.add_argument(\"--text\", dest=\"text_path\", type=str, required=True,\
\ default=argparse.SUPPRESS)\n_parsed_args = vars(_parser.parse_args())\n_output_files\
\ = _parsed_args.pop(\"_output_paths\", [])\n\n_outputs = print_text(**_parsed_args)\n\
\n_output_serializers = [\n\n]\n\nimport os\nfor idx, output_file in enumerate(_output_files):\n\
\ try:\n os.makedirs(os.path.dirname(output_file))\n except OSError:\n\
\ pass\n with open(output_file, 'w') as f:\n f.write(_output_serializers[idx](_outputs[idx]))\n"
image: tensorflow/tensorflow:1.13.2-py3
name: main
workspaces:
- name: print-text
---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
kind: PipelineRun
metadata:
annotations:
pipelines.kubeflow.org/pipeline_spec: '{"name": "Print repeating lines pipeline"}'
sidecar.istio.io/inject: 'false'
tekton.dev/input_artifacts: '{}'
tekton.dev/output_artifacts: '{}'
labels:
pipelines.kubeflow.org/pipeline-sdk-type: kfp
name: print-repeating-lines-pipeline
spec:
tasks:
- name: repeat-line
taskRef:
name: repeat-line
workspaces:
pipelineSpec:
tasks:
- name: repeat-line
workspace: print-repeating-lines-pipeline
- name: print-text
runAfter:
- repeat-line
taskRef:
name: print-text
workspaces:
taskSpec:
steps:
- args:
- --line
- Hello
- --count
- '5000'
- --output-text
- $(workspaces.repeat-line.path)/repeat-line-output_text
command:
- python3
- -u
- -c
- "def _make_parent_dirs_and_return_path(file_path: str):\n import os\n\
\ os.makedirs(os.path.dirname(file_path), exist_ok=True)\n return\
\ file_path\n\ndef repeat_line(line , output_text_path , count = 10):\n\
\ '''Repeat the line specified number of times'''\n with open(output_text_path,\
\ 'w') as writer:\n for i in range(count):\n writer.write(line\
\ + '\\n')\n\nimport argparse\n_parser = argparse.ArgumentParser(prog='Repeat\
\ line', description='Repeat the line specified number of times')\n_parser.add_argument(\"\
--line\", dest=\"line\", type=str, required=True, default=argparse.SUPPRESS)\n\
_parser.add_argument(\"--count\", dest=\"count\", type=int, required=False,\
\ default=argparse.SUPPRESS)\n_parser.add_argument(\"--output-text\",\
\ dest=\"output_text_path\", type=_make_parent_dirs_and_return_path, required=True,\
\ default=argparse.SUPPRESS)\n_parsed_args = vars(_parser.parse_args())\n\
_output_files = _parsed_args.pop(\"_output_paths\", [])\n\n_outputs =\
\ repeat_line(**_parsed_args)\n\n_output_serializers = [\n\n]\n\nimport\
\ os\nfor idx, output_file in enumerate(_output_files):\n try:\n \
\ os.makedirs(os.path.dirname(output_file))\n except OSError:\n\
\ pass\n with open(output_file, 'w') as f:\n f.write(_output_serializers[idx](_outputs[idx]))\n"
image: tensorflow/tensorflow:1.13.2-py3
name: main
workspaces:
- name: repeat-line
workspaces:
- name: repeat-line
workspace: print-repeating-lines-pipeline
- name: print-text
workspace: print-repeating-lines-pipeline
workspaces:
- name: print-repeating-lines-pipeline
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
annotation:
tekton.dev/input_artifacts: '{}'
tekton.dev/output_artifacts: '{}'
name: print-repeating-lines-pipeline-run
spec:
pipelineRef:
name: print-repeating-lines-pipeline
runAfter:
- repeat-line
taskSpec:
steps:
- args:
- --text
- $(workspaces.print-text.path)/repeat-line-output_text
command:
- python3
- -u
- -c
- "def print_text(text_path ): # The \"text\" input is untyped so that any\
\ data can be printed\n '''Print text'''\n with open(text_path,\
\ 'r') as reader:\n for line in reader:\n print(line,\
\ end = '')\n\nimport argparse\n_parser = argparse.ArgumentParser(prog='Print\
\ text', description='Print text')\n_parser.add_argument(\"--text\", dest=\"\
text_path\", type=str, required=True, default=argparse.SUPPRESS)\n_parsed_args\
\ = vars(_parser.parse_args())\n_output_files = _parsed_args.pop(\"_output_paths\"\
, [])\n\n_outputs = print_text(**_parsed_args)\n\n_output_serializers\
\ = [\n\n]\n\nimport os\nfor idx, output_file in enumerate(_output_files):\n\
\ try:\n os.makedirs(os.path.dirname(output_file))\n except\
\ OSError:\n pass\n with open(output_file, 'w') as f:\n \
\ f.write(_output_serializers[idx](_outputs[idx]))\n"
image: tensorflow/tensorflow:1.13.2-py3
name: main
workspaces:
- name: print-text
workspaces:
- name: print-text
workspace: print-repeating-lines-pipeline
workspaces:
- name: print-repeating-lines-pipeline
workspaces:
- name: print-repeating-lines-pipeline
persistentVolumeClaim:
claimName: print-repeating-lines-pipeline-run
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: print-repeating-lines-pipeline-run
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
volumeMode: Filesystem
claimName: print-repeating-lines-pipeline
Loading

0 comments on commit 3f676af

Please sign in to comment.