feat: expose unified exchange activity APIs and exports
This commit is contained in:
@@ -65,6 +65,7 @@ def _complete_snapshot_job(job, load_log, artifact, result) -> dict:
|
||||
if artifact.source in (
|
||||
"sro_membership_check",
|
||||
"fssp_enforcement_proceedings",
|
||||
"stock_exchange_activity",
|
||||
"checko_leasing",
|
||||
"checko_messages",
|
||||
"checko_licenses",
|
||||
@@ -89,6 +90,7 @@ def _claim_snapshot_job(job, source, task_name):
|
||||
"sro_membership_check",
|
||||
"fedresurs_company_profile",
|
||||
"fssp_enforcement_proceedings",
|
||||
"stock_exchange_activity",
|
||||
"checko_leasing",
|
||||
"checko_messages",
|
||||
"checko_licenses",
|
||||
@@ -161,7 +163,13 @@ def _snapshot_error_message(exc: Exception) -> str:
|
||||
|
||||
def _attach_rejected_section(job, source, load_log):
|
||||
if (
|
||||
source in ("checko_leasing", "checko_messages", "checko_licenses")
|
||||
source
|
||||
in (
|
||||
"stock_exchange_activity",
|
||||
"checko_leasing",
|
||||
"checko_messages",
|
||||
"checko_licenses",
|
||||
)
|
||||
and load_log is not None
|
||||
):
|
||||
rejected = (
|
||||
@@ -169,6 +177,7 @@ def _attach_rejected_section(job, source, load_log):
|
||||
source=source,
|
||||
load_batch=load_log.batch_id,
|
||||
status=ParserSourceArtifact.Status.REJECTED,
|
||||
metadata__dataset__isnull=True,
|
||||
)
|
||||
.order_by("-created_at")
|
||||
.first()
|
||||
@@ -416,3 +425,21 @@ def parse_checko_licenses(self, *, requested_by_id: int | None = None) -> dict:
|
||||
requested_by_id=requested_by_id,
|
||||
track_progress=True,
|
||||
)
|
||||
|
||||
|
||||
@shared_task(
|
||||
bind=True,
|
||||
name="parsers.stock_exchange_activity.refresh",
|
||||
soft_time_limit=8 * 3600,
|
||||
time_limit=8 * 3600 + 300,
|
||||
)
|
||||
def parse_stock_exchange_activity(self, *, requested_by_id: int | None = None) -> dict:
|
||||
from apps.parsers.exchange_snapshot import refresh_stock_exchange_activity
|
||||
|
||||
return _run_snapshot(
|
||||
self,
|
||||
source="stock_exchange_activity",
|
||||
refresh=refresh_stock_exchange_activity,
|
||||
requested_by_id=requested_by_id,
|
||||
track_progress=True,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user