-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DOP-22336] Add logic for handling WebDAV transfers (#194)
- Loading branch information
1 parent
f3abd77
commit 49273f2
Showing
19 changed files
with
576 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: WebDAV tests | ||
on: | ||
workflow_call: | ||
|
||
env: | ||
DEFAULT_PYTHON: '3.12' | ||
|
||
jobs: | ||
test: | ||
name: Run WebDAV tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Cache jars | ||
uses: actions/cache@v4 | ||
with: | ||
path: ./cached_jars | ||
key: ${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-test-webdav | ||
restore-keys: | | ||
${{ runner.os }}-python-${{ env.DEFAULT_PYTHON }}-test-webdav | ||
${{ runner.os }}-python- | ||
- name: Build Worker Image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
tags: mtsrus/syncmaster-worker:${{ github.sha }} | ||
target: test | ||
file: docker/Dockerfile.worker | ||
load: true | ||
cache-from: mtsrus/syncmaster-worker:develop | ||
|
||
- name: Docker compose up | ||
run: | | ||
docker compose -f docker-compose.test.yml --profile all down -v --remove-orphans | ||
docker compose -f docker-compose.test.yml --profile webdav up -d --wait --wait-timeout 200 | ||
env: | ||
WORKER_IMAGE_TAG: ${{ github.sha }} | ||
|
||
- name: Run WebDAV Tests | ||
run: | | ||
docker compose -f ./docker-compose.test.yml --profile webdav exec -T worker coverage run -m pytest -vvv -s -m "worker and webdav" | ||
- name: Dump worker logs on failure | ||
if: failure() | ||
uses: jwalton/gh-docker-logs@v2 | ||
with: | ||
images: mtsrus/syncmaster-worker | ||
dest: ./logs | ||
|
||
# This is important, as coverage is exported after receiving SIGTERM | ||
- name: Shutdown | ||
if: always() | ||
run: | | ||
docker compose -f docker-compose.test.yml --profile all down -v --remove-orphans | ||
- name: Upload worker logs | ||
uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: worker-logs-webdav | ||
path: logs/* | ||
|
||
- name: Upload coverage results | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage-webdav | ||
path: reports/* | ||
# https://github.com/actions/upload-artifact/issues/602 | ||
include-hidden-files: true |
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,5 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# allow create files and directories | ||
chown -R www-data:www-data /var/webdav |
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 @@ | ||
Add logic for handling WebDAV transfers |
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,31 @@ | ||
# SPDX-FileCopyrightText: 2023-2024 MTS PJSC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
from onetl.connection import SparkLocalFS, WebDAV | ||
|
||
from syncmaster.dto.connections import WebDAVConnectionDTO | ||
from syncmaster.worker.handlers.file.protocol import FileProtocolHandler | ||
|
||
if TYPE_CHECKING: | ||
from pyspark.sql import SparkSession | ||
|
||
|
||
class WebDAVHandler(FileProtocolHandler): | ||
connection_dto: WebDAVConnectionDTO | ||
|
||
def connect(self, spark: SparkSession) -> None: | ||
self.connection = WebDAV( | ||
host=self.connection_dto.host, | ||
port=self.connection_dto.port, | ||
protocol=self.connection_dto.protocol, | ||
user=self.connection_dto.user, | ||
password=self.connection_dto.password, | ||
ssl_verify=False, | ||
).check() | ||
self.local_connection = SparkLocalFS( | ||
spark=spark, | ||
).check() |
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
Oops, something went wrong.