Skip to content

Commit

Permalink
Merge pull request #66 from beeldengeluid/various-fixes
Browse files Browse the repository at this point in the history
various fixes
  • Loading branch information
Veldhoen authored Jul 19, 2024
2 parents 300daa0 + 0307fb6 commit bf43cd2
Show file tree
Hide file tree
Showing 7 changed files with 175 additions and 215 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: "Install Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.10"
python-version: "3.11"

- name: "Install poetry"
run: "pip install --user poetry"
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ RUN apt-get clean && apt-get update -y && apt-get upgrade -y
RUN apt-get install -y libgl1 ffmpeg

RUN pip install --upgrade pip
RUN pip install scenedetect[opencv] --upgrade
RUN pip install poetry==1.5.1

# Create dirs for:
Expand Down
4 changes: 0 additions & 4 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,3 @@
echo "Starting DANE video segmentation worker"

poetry run python worker.py "$@"

echo The worker crashed, tailing /dev/null for debugging

tail -f /dev/null
12 changes: 0 additions & 12 deletions io_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,6 @@ def delete_input_file(input_file: str, actually_delete: bool) -> bool:
logger.exception("Could not delete input file")
return False

# now remove the "chunked path" from /mnt/dane-fs/input-files/03/d2/8a/03d28a03643a981284b403b91b95f6048576c234/xyz.mp4
try:
os.chdir(get_download_dir()) # cd /mnt/dane-fs/input-files
os.removedirs(
f".{input_file[len(get_download_dir()):input_file.rfind(os.sep)]}"
) # /03/d2/8a/03d28a03643a981284b403b91b95f6048576c234
logger.info("Deleted empty input dirs too")
except OSError:
logger.exception("OSError while removing empty input file dirs")
except FileNotFoundError:
logger.exception("FileNotFoundError while removing empty input file dirs")

return True # return True even if empty dirs were not removed


Expand Down
350 changes: 162 additions & 188 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = ["Jaap Blom <jblom@beeldengeluid.nl>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10"
python = "^3.11"
yacs = "^0.1.8"
pika = "^1.3.2"
requests = "^2.32.0"
Expand Down Expand Up @@ -42,7 +42,7 @@ omit = [

[tool.black]
line-length = 88
target_version = ['py310']
target_version = ['py311']
include = '\.pyi?$'
exclude = '''
Expand All @@ -58,7 +58,7 @@ exclude = '''
'''

[tool.mypy]
python_version = "3.10"
python_version = "3.11"

[[tool.mypy.overrides]]
module = [
Expand Down
15 changes: 9 additions & 6 deletions worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,15 @@ def callback(self, task: Task, doc: Document) -> CallbackResponse:
logger.info(
"applying IO on output went well, now finally saving to DANE index"
)
self.save_to_dane_index(
doc,
task,
get_s3_output_file_uri(get_source_id(input_file_path)),
provenance=full_provenance_chain,
)
try:
self.save_to_dane_index(
doc,
task,
get_s3_output_file_uri(get_source_id(input_file_path)),
provenance=full_provenance_chain,
)
except Exception as e:
logger.exception(f"Failed to save to DANE index: {e}")
return processing_result

def save_to_dane_index(
Expand Down

0 comments on commit bf43cd2

Please sign in to comment.