-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples: refactor a bit the examples
- moved the common storage code to vdk-storage library - refactored confluence-reader to directly use it instead of using file
- Loading branch information
1 parent
8c67726
commit 30fb03a
Showing
21 changed files
with
254 additions
and
83 deletions.
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
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
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
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
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
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,29 @@ | ||
# Copyright 2021-2024 VMware, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
import os | ||
Check notice on line 3 in examples/pgvector-embedder/01_local_properties.py
|
||
|
||
from vdk.api.job_input import IJobInput | ||
|
||
|
||
def set_property(job_input: IJobInput, key, value): | ||
props = job_input.get_all_properties() | ||
props[key] = value | ||
job_input.set_all_properties(props) | ||
|
||
|
||
def run(job_input: IJobInput): | ||
set_property( | ||
job_input, | ||
"storage_connection_string", | ||
"postgresql://pgadmin:[email protected]:5432/spulov-test", | ||
) | ||
|
||
props = job_input.get_all_properties() | ||
props.update( | ||
dict( | ||
destination_metadata_table="vdk_confluence_sc_metadata", | ||
destination_embeddings_table="vdk_confluence_sc_embeddings", | ||
storage_name="supercollider_chunked", | ||
) | ||
) | ||
job_input.set_all_properties(props) |
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,14 @@ | ||
# Copyright 2021-2024 VMware, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
import os.path | ||
import pathlib | ||
Check notice on line 4 in examples/pgvector-embedder/01_setup_huggingface.py
|
||
|
||
from vdk.api.job_input import IJobInput | ||
|
||
|
||
def run(job_input: IJobInput): | ||
# HF uses temporary directories in the process of its work | ||
# So make sure to use only allowed ones | ||
hf_home = job_input.get_temporary_write_directory() / "hf" | ||
hf_home.mkdir(parents=True, exist_ok=True) | ||
os.environ["HF_HOME"] = str(hf_home) |
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
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
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
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 |
---|---|---|
|
@@ -4,3 +4,5 @@ psycopg2-binary | |
sentence-transformers | ||
sqlalchemy | ||
vdk-postgres | ||
|
||
vdk-storage |
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,22 @@ | ||
# Copyright 2021-2024 VMware, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
image: "python:3.7" | ||
|
||
.build-vdk-storage: | ||
variables: | ||
PLUGIN_NAME: vdk-storage | ||
extends: .build-plugin | ||
|
||
build-py37-vdk-storage: | ||
extends: .build-vdk-storage | ||
image: "python:3.7" | ||
|
||
build-py311-vdk-storage: | ||
extends: .build-vdk-storage | ||
image: "python:3.11" | ||
|
||
release-vdk-storage: | ||
variables: | ||
PLUGIN_NAME: vdk-storage | ||
extends: .release-plugin |
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,43 @@ | ||
# storage | ||
|
||
Library for access to different managed storages | ||
|
||
|
||
## Usage | ||
|
||
``` | ||
pip install vdk-storage | ||
``` | ||
|
||
### Configuration | ||
|
||
(`vdk config-help` is useful command to browse all config options of your installation of vdk) | ||
|
||
| Name | Description | (example) Value | | ||
|---|---|---| | ||
| dummy_config_key | Dummy configuration | "Dummy" | | ||
|
||
### Example | ||
|
||
TODO | ||
|
||
### Build and testing | ||
|
||
``` | ||
pip install -r requirements.txt | ||
pip install -e . | ||
pytest | ||
``` | ||
|
||
In VDK repo [../build-plugin.sh](https://github.com/vmware/versatile-data-kit/tree/main/projects/vdk-plugins/build-plugin.sh) script can be used also. | ||
|
||
|
||
#### Note about the CICD: | ||
|
||
.plugin-ci.yaml is needed only for plugins part of [Versatile Data Kit Plugin repo](https://github.com/vmware/versatile-data-kit/tree/main/projects/vdk-plugins). | ||
|
||
The CI/CD is separated in two stages, a build stage and a release stage. | ||
The build stage is made up of a few jobs, all which inherit from the same | ||
job configuration and only differ in the Python version they use (3.7, 3.8, 3.9 and 3.10). | ||
They run according to rules, which are ordered in a way such that changes to a | ||
plugin's directory trigger the plugin CI, but changes to a different plugin does not. |
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,7 @@ | ||
# this file is used to provide testing requirements | ||
# for requirements (dependencies) needed during and after installation of the plugin see (and update) setup.py install_requires section | ||
|
||
|
||
pytest | ||
vdk-core | ||
vdk-test-utils |
Oops, something went wrong.