refactor(services): remove too many imports and cleanup

This commit is contained in:
Houkime 2024-03-01 14:30:54 +00:00 committed by Inex Code
parent 305e5cc2c3
commit 3f9d2b2481
3 changed files with 6 additions and 8 deletions

View file

@ -30,7 +30,5 @@ def move_service(service_id: str, volume_name: str) -> Job:
description=f"Moving {service.get_display_name()} data to {volume.name}", description=f"Moving {service.get_display_name()} data to {volume.name}",
) )
handle = move_service_task(service, volume, job) move_service_task(service, volume, job)
# Nonblocking
handle()
return job return job

View file

@ -5,7 +5,6 @@ import strawberry
from selfprivacy_api.graphql import IsAuthenticated from selfprivacy_api.graphql import IsAuthenticated
from selfprivacy_api.graphql.common_types.jobs import job_to_api_job from selfprivacy_api.graphql.common_types.jobs import job_to_api_job
from selfprivacy_api.jobs import JobStatus from selfprivacy_api.jobs import JobStatus
from selfprivacy_api.utils.block_devices import BlockDevices
from traceback import format_tb as format_traceback from traceback import format_tb as format_traceback
@ -23,7 +22,6 @@ from selfprivacy_api.actions.services import (
ServiceNotFoundError, ServiceNotFoundError,
VolumeNotFoundError, VolumeNotFoundError,
) )
from selfprivacy_api.services.moving import MoveError
from selfprivacy_api.services import get_service_by_id from selfprivacy_api.services import get_service_by_id

View file

@ -268,10 +268,12 @@ class Jobs:
return False return False
# A terse way to call a common operation, for readability
# job.report_progress() would be even better
# but it would go against how this file is written
def report_progress(progress: int, job: Job, status_text: str) -> None: def report_progress(progress: int, job: Job, status_text: str) -> None:
"""
A terse way to call a common operation, for readability
job.report_progress() would be even better
but it would go against how this file is written
"""
Jobs.update( Jobs.update(
job=job, job=job,
status=JobStatus.RUNNING, status=JobStatus.RUNNING,