461bf6fd40
CI / lint (3.11) (push) Blocked by required conditions
CI / lint (3.12) (push) Blocked by required conditions
CI / lint (3.13) (push) Blocked by required conditions
CI / shellcheck (push) Waiting to run
CI / shfmt (push) Waiting to run
CI / setup (3.11) (push) Waiting to run
CI / setup (3.12) (push) Waiting to run
CI / setup (3.13) (push) Waiting to run
CI / check-licenses (3.12) (push) Blocked by required conditions
CI / test_unit (3.11) (push) Blocked by required conditions
CI / test_unit (3.12) (push) Blocked by required conditions
CI / test_unit (3.13) (push) Blocked by required conditions
CI / test_unit_no_extras (3.11) (push) Blocked by required conditions
CI / test_unit_no_extras (3.12) (push) Blocked by required conditions
CI / test_json_to_html (3.12) (push) Blocked by required conditions
CI / test_unit_no_extras (3.13) (push) Blocked by required conditions
CI / test_unit_dependency_extras (csv, 3.11, --extra csv) (push) Blocked by required conditions
CI / test_unit_dependency_extras (csv, 3.12, --extra csv) (push) Blocked by required conditions
CI / test_unit_dependency_extras (csv, 3.13, --extra csv) (push) Blocked by required conditions
CI / test_unit_dependency_extras (docx, 3.11, --extra docx) (push) Blocked by required conditions
CI / test_unit_dependency_extras (docx, 3.12, --extra docx) (push) Blocked by required conditions
CI / test_unit_dependency_extras (docx, 3.13, --extra docx) (push) Blocked by required conditions
CI / test_unit_dependency_extras (markdown, 3.11, --extra md) (push) Blocked by required conditions
CI / test_unit_dependency_extras (markdown, 3.12, --extra md) (push) Blocked by required conditions
CI / test_unit_dependency_extras (markdown, 3.13, --extra md) (push) Blocked by required conditions
CI / test_unit_dependency_extras (odt, 3.11, --extra odt) (push) Blocked by required conditions
CI / test_unit_dependency_extras (odt, 3.12, --extra odt) (push) Blocked by required conditions
CI / test_unit_dependency_extras (pdf-image, 3.12, --extra pdf --extra image --extra paddleocr) (push) Blocked by required conditions
CI / test_unit_dependency_extras (pdf-image, 3.13, --extra pdf --extra image --extra paddleocr) (push) Blocked by required conditions
CI / test_unit_dependency_extras (pptx, 3.13, --extra pptx) (push) Blocked by required conditions
CI / test_unit_dependency_extras (odt, 3.13, --extra odt) (push) Blocked by required conditions
CI / test_unit_dependency_extras (pdf-image, 3.11, --extra pdf --extra image --extra paddleocr) (push) Blocked by required conditions
CI / test_unit_dependency_extras (pptx, 3.11, --extra pptx) (push) Blocked by required conditions
CI / test_unit_dependency_extras (pptx, 3.12, --extra pptx) (push) Blocked by required conditions
CI / test_unit_dependency_extras (pypandoc, 3.11, --extra epub --extra org --extra rtf --extra rst) (push) Blocked by required conditions
CI / test_unit_dependency_extras (pypandoc, 3.12, --extra epub --extra org --extra rtf --extra rst) (push) Blocked by required conditions
CI / test_unit_dependency_extras (pypandoc, 3.13, --extra epub --extra org --extra rtf --extra rst) (push) Blocked by required conditions
CI / test_unit_dependency_extras (xlsx, 3.11, --extra xlsx) (push) Blocked by required conditions
CI / test_unit_dependency_extras (xlsx, 3.12, --extra xlsx) (push) Blocked by required conditions
CI / test_unit_dependency_extras (xlsx, 3.13, --extra xlsx) (push) Blocked by required conditions
CI / test_ingest_src (3.12) (push) Blocked by required conditions
CI / test_json_to_markdown (3.12) (push) Blocked by required conditions
CI / changelog (push) Waiting to run
CI / test_dockerfile (push) Blocked by required conditions
CodeQL / Analyze (python) (push) Waiting to run
Build And Push Docker Image / set-short-sha (push) Waiting to run
Build And Push Docker Image / build-images (linux/amd64, opensource-linux-8core) (push) Blocked by required conditions
Build And Push Docker Image / build-images (linux/arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
Build And Push Docker Image / publish-images (push) Blocked by required conditions
Partition Benchmark / setup (push) Waiting to run
Partition Benchmark / Measure and compare partition() runtime (push) Blocked by required conditions
80 lines
2.0 KiB
Python
80 lines
2.0 KiB
Python
#!/usr/bin/env python
|
|
import json
|
|
|
|
import click
|
|
from databricks.sdk import WorkspaceClient
|
|
|
|
|
|
@click.group()
|
|
def cli():
|
|
pass
|
|
|
|
|
|
def _get_volume_path(catalog: str, volume: str, volume_path: str):
|
|
return f"/Volumes/{catalog}/default/{volume}/{volume_path}"
|
|
|
|
|
|
@cli.command()
|
|
@click.option("--host", type=str, required=True)
|
|
@click.option("--username", type=str, required=True)
|
|
@click.option("--password", type=str, required=True)
|
|
@click.option("--catalog", type=str, required=True)
|
|
@click.option("--volume", type=str, required=True)
|
|
@click.option("--volume-path", type=str, required=True)
|
|
def test(
|
|
host: str,
|
|
username: str,
|
|
password: str,
|
|
catalog: str,
|
|
volume: str,
|
|
volume_path: str,
|
|
):
|
|
client = WorkspaceClient(host=host, username=username, password=password)
|
|
files = list(
|
|
client.files.list_directory_contents(_get_volume_path(catalog, volume, volume_path))
|
|
)
|
|
|
|
assert len(files) == 1
|
|
|
|
resp = client.files.download(files[0].path)
|
|
data = json.loads(resp.contents.read())
|
|
|
|
assert len(data) == 5
|
|
assert [v["type"] for v in data] == [
|
|
"UncategorizedText",
|
|
"Title",
|
|
"NarrativeText",
|
|
"UncategorizedText",
|
|
"Title",
|
|
]
|
|
|
|
print("Databricks test passed!")
|
|
|
|
|
|
@cli.command()
|
|
@click.option("--host", type=str, required=True)
|
|
@click.option("--username", type=str, required=True)
|
|
@click.option("--password", type=str, required=True)
|
|
@click.option("--catalog", type=str, required=True)
|
|
@click.option("--volume", type=str, required=True)
|
|
@click.option("--volume-path", type=str, required=True)
|
|
def cleanup(
|
|
host: str,
|
|
username: str,
|
|
password: str,
|
|
catalog: str,
|
|
volume: str,
|
|
volume_path: str,
|
|
):
|
|
client = WorkspaceClient(host=host, username=username, password=password)
|
|
|
|
for file in client.files.list_directory_contents(
|
|
_get_volume_path(catalog, volume, volume_path)
|
|
):
|
|
client.files.delete(file.path)
|
|
client.files.delete_directory(_get_volume_path(catalog, volume, volume_path))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
cli()
|