-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vdk-notebook: handle job with mixed .ipynb, .py, .sql files use-case (#…
…2279) What: Added string function to the stepBuilder, which is being called when a new notebook step is added to the job. This ensures that the steps are executed alphanumerically. Why: currently, when we execute "vdk run" firstly all the python and sql files are executed and then the notebook files (which is not expected since we expect vdk run to run files alphanumerically) Signed-off-by: Duygu Hasan [hduygu@vmware.com](mailto:hduygu@vmware.com)
- Loading branch information
1 parent
9a95e14
commit 48ae6b8
Showing
7 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
projects/vdk-plugins/vdk-notebook/tests/jobs/mixed-rest-api/10_delete_table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP TABLE IF EXISTS rest_target_table; |
42 changes: 42 additions & 0 deletions
42
projects/vdk-plugins/vdk-notebook/tests/jobs/mixed-rest-api/20_create_table.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "826a105f-1874-4251-8abd-75fb898ba71c", | ||
"metadata": { | ||
"pycharm": { | ||
"name": "#%%\n" | ||
}, | ||
"tags": [ | ||
"vdk" | ||
] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"job_input.execute_query(\"CREATE TABLE rest_target_table (userId, id, title, completed);\")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.0" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
13 changes: 13 additions & 0 deletions
13
projects/vdk-plugins/vdk-notebook/tests/jobs/mixed-rest-api/30_rest_ingest.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright 2021-2023 VMware, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
import requests | ||
|
||
|
||
def run(job_input): | ||
response = requests.get("https://jsonplaceholder.typicode.com/todos/1") | ||
response.raise_for_status() | ||
payload = response.json() | ||
|
||
job_input.send_object_for_ingestion( | ||
payload=payload, destination_table="rest_target_table" | ||
) |
16 changes: 16 additions & 0 deletions
16
projects/vdk-plugins/vdk-notebook/tests/jobs/mixed-rest-api/config.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
; Supported format: https://docs.python.org/3/library/configparser.html#supported-ini-file-structure | ||
|
||
; This is the only file required to deploy a Data Job. | ||
; Read more to understand what each option means: | ||
|
||
; Information about the owner of the Data Job | ||
[owner] | ||
|
||
; Team is a way to group Data Jobs that belonged to the same team. | ||
team = jupyter-test-jobs | ||
|
||
[vdk] | ||
; Key value pairs of any configuration options that can be passed to vdk. | ||
; For possible options in your vdk installation execute command vdk config-help | ||
db_default_type=SQLITE | ||
ingest_method_default=SQLITE |
5 changes: 5 additions & 0 deletions
5
projects/vdk-plugins/vdk-notebook/tests/jobs/mixed-rest-api/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Python jobs can specify extra library dependencies in requirements.txt file. | ||
# See https://pip.readthedocs.io/en/stable/user_guide/#requirements-files | ||
# The file is optional and can be deleted if no extra library dependencies are necessary. | ||
|
||
requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters