VisibilityHandler #3

Merged
erth9960 merged 4 commits from visibility into master 2024-03-27 14:54:33 +01:00
16 changed files with 7 additions and 20 deletions
Showing only changes of commit 83b59fffec - Show all commits

View File

@ -1,6 +1,5 @@
import logging import logging
import logging.handlers import logging.handlers
import multiprocessing as mp
import os import os
import shutil import shutil

View File

@ -1,4 +1,3 @@
import logging
from abc import ABCMeta, abstractmethod from abc import ABCMeta, abstractmethod
from pathlib import Path from pathlib import Path

View File

@ -1,5 +1,4 @@
from .handler import Handler from .handler import Handler
from ..exceptions import ValidationException
@Handler.register @Handler.register

View File

@ -79,7 +79,7 @@ class PosterHandler(Handler):
super()._validate(jobspec, existing_package) super()._validate(jobspec, existing_package)
if uploaded: if uploaded:
if 'upload_dir' not in jobspec: if 'upload_dir' not in jobspec:
raise ValidationException(f"upload_dir missing") raise ValidationException("upload_dir missing")
for name, poster in uploaded.items(): for name, poster in uploaded.items():
if not path.isfile(path.join(jobspec['upload_dir'], if not path.isfile(path.join(jobspec['upload_dir'],
poster)): poster)):

View File

@ -1,5 +1,4 @@
from os import path, rename from os import path, rename
from shutil import rmtree
import ffmpeg import ffmpeg

View File

@ -1,4 +1,3 @@
import logging
from pathlib import Path from pathlib import Path

View File

@ -6,12 +6,10 @@ from multiprocessing import Process, Queue
from pathlib import Path from pathlib import Path
from queue import Empty from queue import Empty
from time import sleep from time import sleep
from threading import Event
from .handler import Handler from .handler import Handler
from ..exceptions import ConfigurationException, ValidationException from ..exceptions import ValidationException
import torch
import whisper import whisper
import whisper.utils import whisper.utils
@ -58,7 +56,7 @@ def _whisper_processor(inqueue,
if language is None: if language is None:
out_language = result['language'] out_language = result['language']
logger.info( logger.info(
f"Detected language '%s' in %s.", out_language, inpath) "Detected language '%s' in %s.", out_language, inpath)
else: else:
out_language = language out_language = language

View File

@ -5,7 +5,6 @@ from multiprocessing import Process, Queue
from pathlib import Path from pathlib import Path
from queue import Empty from queue import Empty
from time import sleep from time import sleep
from threading import Event
from .handler import Handler from .handler import Handler
from ..exceptions import ConfigurationException, ValidationException from ..exceptions import ConfigurationException, ValidationException

View File

@ -1,5 +1,4 @@
from ldap3 import Connection, ObjectDef, Reader, Server from ldap3 import Connection, ObjectDef, Reader, Server
from ldap3.core.exceptions import LDAPSocketSendError
class Ldap: class Ldap:
def __init__(self, conf): def __init__(self, conf):

View File

@ -1,5 +1,4 @@
import json import json
import logging
from dataclasses import asdict, dataclass from dataclasses import asdict, dataclass
from pprint import pformat from pprint import pformat

View File

@ -2,7 +2,7 @@ import json
from copy import deepcopy from copy import deepcopy
from os import mkdir, path, rename, remove from os import mkdir, path, rename, remove
from shutil import copy, copytree from shutil import copytree
import ffmpeg import ffmpeg

View File

@ -110,4 +110,4 @@ class CatturaProcessor(Preprocessor):
for key in data.keys(): for key in data.keys():
if key.startswith('mediapackage:'): if key.startswith('mediapackage:'):
return data[key] return data[key]
raise KeyError(f"no 'mediapackage' key in job specification") raise KeyError("no 'mediapackage' key in job specification")

View File

@ -1,5 +1,4 @@
from abc import ABCMeta, abstractmethod from abc import ABCMeta, abstractmethod
from os import mkdir, path
from ..queuethread import QueueThread from ..queuethread import QueueThread

View File

@ -1,4 +1,3 @@
import logging
import multiprocessing as mp import multiprocessing as mp
from collections import deque from collections import deque
@ -6,7 +5,7 @@ from collections.abc import Iterable
from dataclasses import dataclass from dataclasses import dataclass
from pprint import pformat from pprint import pformat
from threading import Event from threading import Event
from time import sleep, strftime from time import sleep
from typing import Callable from typing import Callable
from .queuethread import QueueThread from .queuethread import QueueThread

View File

@ -5,7 +5,6 @@ import sys
from configparser import ConfigParser from configparser import ConfigParser
from os import path from os import path
from time import sleep
from pipeline import Pipeline from pipeline import Pipeline

View File

@ -272,7 +272,7 @@ class PipelineTest(DaemonTest):
print("¤ Contents of invalid notification file ¤") print("¤ Contents of invalid notification file ¤")
print(f.read()) print(f.read())
print("¤ End invalid notification file contents ¤") print("¤ End invalid notification file contents ¤")
self.fail(f"Invalid JSON in result file.") self.fail("Invalid JSON in result file.")
# Validate that this is the correct resultfile # Validate that this is the correct resultfile
self.assertEqual(jobid, result['jobid']) self.assertEqual(jobid, result['jobid'])