Skip to content

Commit

Permalink
change ENABLED config var with BUCKET and HOST
Browse files Browse the repository at this point in the history
  • Loading branch information
duprijil committed Sep 29, 2023
1 parent 8449c26 commit ef84a41
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
6 changes: 3 additions & 3 deletions dags/pipelines/notice_processor_pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def notice_publish_pipeline(notice: Notice, mongodb_client: MongoClient = None)
notice.update_status_to(new_status=NoticeStatus.PACKAGED)

unpublished_channels_count: int = 0
if config.S3_PUBLISH_NOTICE_ENABLED:
if config.S3_PUBLISH_NOTICE_BUCKET:
publish_notice_into_s3 = publish_notice_into_s3(notice=notice)
if not publish_notice_into_s3:
unpublished_channels_count += 1
Expand All @@ -125,7 +125,7 @@ def notice_publish_pipeline(notice: Notice, mongodb_client: MongoClient = None)
notice_eforms_subtype=notice.normalised_metadata.eforms_subtype)


if config.S3_PUBLISH_NOTICE_RDF_ENABLED:
if config.S3_PUBLISH_NOTICE_RDF_BUCKET:
published_rdf_into_s3 = publish_notice_rdf_into_s3(notice=notice)
if not published_rdf_into_s3:
unpublished_channels_count += 1
Expand All @@ -136,7 +136,7 @@ def notice_publish_pipeline(notice: Notice, mongodb_client: MongoClient = None)

notice.set_is_eligible_for_publishing(eligibility=True)

if config.SFTP_PUBLISH_NOTICE_ENABLED:
if config.SFTP_PUBLISH_HOST:
sftp_publish_result = publish_notice(notice=notice)
if not sftp_publish_result:
unpublished_channels_count += 1
Expand Down
11 changes: 0 additions & 11 deletions ted_sws/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,6 @@ def SFTP_PRIVATE_KEY(self) -> str:
sftp_private_key_base64 = base64.b64decode(str(sftp_private_key_base64)).decode(encoding="utf-8")
return sftp_private_key_base64

@env_property(config_resolver_class=AirflowAndEnvConfigResolver, default_value="false")
def SFTP_PUBLISH_NOTICE_ENABLED(self, config_value: str) -> bool:
return config_value.lower() in ["1", "true"]


class SPARQLConfig:

Expand Down Expand Up @@ -261,13 +257,6 @@ def S3_PUBLISH_NOTICE_BUCKET(self, config_value: str) -> str:
def S3_PUBLISH_NOTICE_RDF_BUCKET(self, config_value: str) -> str:
return config_value

@env_property(config_resolver_class=AirflowAndEnvConfigResolver, default_value="false")
def S3_PUBLISH_NOTICE_ENABLED(self, config_value: str) -> bool:
return config_value.lower() in ["1", "true"]

@env_property(config_resolver_class=AirflowAndEnvConfigResolver, default_value="false")
def S3_PUBLISH_NOTICE_RDF_ENABLED(self, config_value: str) -> bool:
return config_value.lower() in ["1", "true"]


class AirflowConfig:
Expand Down

0 comments on commit ef84a41

Please sign in to comment.