Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
python-version: 3.12
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.12
uses: actions/setup-python@v1
with:
python-version: 3.9
python-version: 3.12
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/*
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repos:
- id: black
language_version: python3
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
rev: 7.3.0
hooks:
- id: flake8
- repo: https://github.com/sqlfluff/sqlfluff
Expand Down
7 changes: 7 additions & 0 deletions linkage_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,11 @@
trigger_dag_id="affiliations",
)

trigger_almanac_classifiers = TriggerDagRunOperator(
task_id="trigger_almanac_classifiers",
trigger_dag_id="almanac_classifiers",
)

curr_date = datetime.now().strftime("%Y%m%d")
with open(
f"{os.environ.get('DAGS_FOLDER')}/schemas/{gcs_folder}/table_descriptions.json"
Expand Down Expand Up @@ -679,6 +684,7 @@
>> update_archive
>> success_alert
>> trigger_affiliations
>> trigger_almanac_classifiers
)

# We don't show the "all metadata" table in the production dataset, but we do need to
Expand Down Expand Up @@ -732,6 +738,7 @@
gce_instance_start >> gce_instance_stop

gce_instance_create >> run_lid >> gce_instance_delete
# run_lid >> gce_instance_stop

(
gce_instance_delete
Expand Down
11 changes: 10 additions & 1 deletion utils/run_lid.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,17 @@ def add_cld2_outputs(self, record: dict) -> None:
if encoding is None:
encoding = "latin-1" # last-ditch effort...
is_reliable, text_bytes_found, details = cld2.detect(
record[field].encode("utf-8").decode(encoding)
record[field].encode(encoding, "surrogatepass").decode(encoding)
)
except UnicodeDecodeError as e:
logging.warning(
"utf-8 failed, attempting to get rid of surrogate characters"
)
logging.warning(e)
is_reliable, text_bytes_found, details = cld2.detect(
record[field].encode("utf-8", "surrogatepass").decode("utf-8")
)

record[field + "_cld2_lid_success"] = True
record[field + "_cld2_lid_is_reliable"] = is_reliable
# details looks like: (('RUSSIAN', 'ru', 98, 404.0), ('Unknown', 'un', 0, 0.0), ('Unknown', 'un', 0, 0.0))
Expand Down
Loading