Skip to content

Commit

Permalink
[Fixes #227] Cleanup not-user code
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiagiupponi committed May 3, 2024
1 parent eeb20c6 commit bba1885
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions importer/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,8 @@ class ImportOrchestrator:
it call the next step of the import pipeline
Params:
enable_legacy_upload_status default=True: if true, will save the upload progress
also in the legacy upload system
"""

def __init__(self, enable_legacy_upload_status=True) -> None:
self.enable_legacy_upload_status = enable_legacy_upload_status

def get_handler(self, _data) -> Optional[BaseHandler]:
"""
If is part of the supported format, return the handler which can handle the import
Expand Down Expand Up @@ -315,22 +310,6 @@ def create_execution_request(
name=name,
source=source,
)
if self.enable_legacy_upload_status:
# getting the package name from the base_filename
Upload.objects.create(
name=legacy_upload_name
or os.path.basename(input_params.get("files", {}).get("base_file")),
state=STATE_RUNNING,
user=user,
metadata={
**{
"func_name": func_name,
"step": step,
"exec_id": str(execution.exec_id),
},
**input_params,
},
)
return execution.exec_id

def update_execution_request_status(
Expand All @@ -350,12 +329,6 @@ def update_execution_request_status(

ExecutionRequest.objects.filter(exec_id=execution_id).update(**kwargs)

if self.enable_legacy_upload_status:
Upload.objects.filter(metadata__contains=execution_id).update(
state=legacy_status,
complete=True,
metadata={**kwargs, **{"exec_id": execution_id}},
)
if celery_task_request:
TaskResult.objects.filter(task_id=celery_task_request.id).update(
task_args=celery_task_request.args
Expand All @@ -371,4 +344,4 @@ def _last_step(self, execution_id, handler_module_path):
return self.load_handler(handler_module_path).perform_last_step(execution_id)


orchestrator = ImportOrchestrator(enable_legacy_upload_status=False)
orchestrator = ImportOrchestrator()

0 comments on commit bba1885

Please sign in to comment.