Skip to content

Commit

Permalink
Merge pull request #48 from cloudblue/LITE-30133-force-upload-can-not…
Browse files Browse the repository at this point in the history
…-create-schedule-task

LITE-30133 Force upload action can not create schedule task
  • Loading branch information
akodelia authored May 10, 2024
2 parents 2d65764 + 35cf935 commit d9756d5
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions connect_bi_reporter/uploads/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
from connect.eaas.core.decorators import router
from connect.eaas.core.inject.common import get_call_context, get_logger
from connect.eaas.core.inject.models import Context
from connect.eaas.core.inject.synchronous import get_installation, get_installation_client
from connect.eaas.core.inject.synchronous import (
get_extension_client,
get_installation,
get_installation_client,
)
from connect_extension_utils.api.pagination import apply_pagination, PaginationParams
from connect_extension_utils.db.models import get_db, VerboseBaseSession

Expand Down Expand Up @@ -71,18 +75,27 @@ def get_retry_upload(
feed_id: str,
upload_id: str,
db: VerboseBaseSession = Depends(get_db),
client: ConnectClient = Depends(get_installation_client),
extension_client: ConnectClient = Depends(get_extension_client),
context: Context = Depends(get_call_context),
logger: Logger = Depends(get_logger),
installation: dict = Depends(get_installation),
):
scheduler = Scheduler(client, context, logger)
scheduler = Scheduler(extension_client, context, logger)
upload = retry_failed_upload(db, installation, feed_id, upload_id, scheduler)
return map_to_upload_schema(upload)

def _force_upload(self, db, client, context, logger, installation, feed):
scheduler = Scheduler(client, context, logger)
upload = force_upload(db, client, scheduler, installation, feed)
def _force_upload(
self,
db,
extension_client,
installation_client,
context,
logger,
installation,
feed,
):
scheduler = Scheduler(extension_client, context, logger)
upload = force_upload(db, installation_client, scheduler, installation, feed)
return map_to_upload_schema(upload)

@router.post(
Expand All @@ -95,10 +108,19 @@ def force_upload(
self,
feed_id: str,
db: VerboseBaseSession = Depends(get_db),
client: ConnectClient = Depends(get_installation_client),
extension_client: ConnectClient = Depends(get_extension_client),
installation_client: ConnectClient = Depends(get_installation_client),
context: Context = Depends(get_call_context),
logger: Logger = Depends(get_logger),
installation: dict = Depends(get_installation),
):
feed = get_feed_for_uploads(db, installation, feed_id)
return self._force_upload(db, client, context, logger, installation, feed)
return self._force_upload(
db,
extension_client,
installation_client,
context,
logger,
installation,
feed,
)

0 comments on commit d9756d5

Please sign in to comment.