Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Marigold committed Aug 22, 2024
1 parent 6c7bda3 commit 15a7fd1
Show file tree
Hide file tree
Showing 13 changed files with 10 additions and 416 deletions.
265 changes: 0 additions & 265 deletions apps/backport/bulk_backport.py

This file was deleted.

8 changes: 0 additions & 8 deletions apps/backport/fasttrack_backport.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,6 @@ def migrate(
# backport to refresh snapshots in S3
if pb.needs_update():
pb.upload(upload=True, dry_run=False, engine=engine)
# run ETL on backport
else:
from etl.command import main

main(
[pb.short_name],
backport=True,
)

spreadsheet = client.open(spreadsheet_title)

Expand Down
1 change: 0 additions & 1 deletion apps/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ def _lazy_load(self, cmd_name):
"commands": {
"fasttrack": "apps.backport.fasttrack_backport.cli",
"migrate": "apps.backport.migrate.migrate.cli",
"bulk": "apps.backport.bulk_backport.bulk_backport",
"run": "apps.backport.backport.backport_cli",
},
},
Expand Down
17 changes: 0 additions & 17 deletions docs/architecture/design/uri.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,3 @@ where
!!! example

`walden://irena/2022-10-07/renewable_electricity_capacity_and_generation`

### Path for `backport://`

```
backport://backport/owid/latest/<dataset-name>
```

where

| Prefix | Description |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `dataset-name` | Name of the dataset. It follows the format `dataset_<dataset-id>_<dataset-name>`, where `dataset-id` corresponds to the dataset Grapher id and `dataset-name` is the name of the dataset in Grapher (with lower case, and all symbols replaced by underscores). |

!!! example

`backport://backport/owid/latest/dataset_5676_global_health_observatory__world_health_organization__2022_08`

24 changes: 2 additions & 22 deletions etl/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,6 @@
is_flag=True,
help="Run the debugger on uncaught exceptions.",
)
@click.option(
"--backport",
"-b",
is_flag=True,
help="Add steps for backporting OWID datasets.",
)
@click.option(
"--downstream",
"-d",
Expand Down Expand Up @@ -151,7 +145,6 @@ def main_cli(
private: bool = False,
grapher: bool = False,
explorer: bool = False,
backport: bool = False,
ipdb: bool = False,
downstream: bool = False,
only: bool = False,
Expand Down Expand Up @@ -203,7 +196,6 @@ def main_cli(
private=private,
grapher=grapher,
explorer=explorer,
backport=backport,
downstream=downstream,
only=only,
exclude=exclude,
Expand Down Expand Up @@ -236,7 +228,6 @@ def main(
private: bool = False,
grapher: bool = False,
explorer: bool = False,
backport: bool = False,
downstream: bool = False,
only: bool = False,
exclude: Optional[str] = None,
Expand All @@ -256,7 +247,7 @@ def main(
# Given that (indicator-based) explorers will always rely on grapher steps, ensure the grapher flag is set.
grapher = True

dag = construct_dag(dag_path, backport=backport, private=private, grapher=grapher)
dag = construct_dag(dag_path, private=private, grapher=grapher)

excludes = exclude.split(",") if exclude else []

Expand Down Expand Up @@ -285,23 +276,12 @@ def sanity_check_db_settings() -> None:
sys.exit(1)


def construct_dag(dag_path: Path, backport: bool, private: bool, grapher: bool) -> DAG:
def construct_dag(dag_path: Path, private: bool, grapher: bool) -> DAG:
"""Construct full DAG."""

# Load our graph of steps and the things they depend on
dag = load_dag(dag_path)

# If backport is set, add all backport steps. Otherwise add only those used in DAG
if backport:
filter_steps = None
else:
# Get all backported datasets that are used in the DAG
filter_steps = {dep for deps in dag.values() for dep in deps if dep.startswith("backport://")}

backporting_dag = _backporting_steps(private, filter_steps=filter_steps)

dag.update(backporting_dag)

# If --grapher is set, add steps for upserting to DB
if grapher:
dag.update(_grapher_steps(dag, private))
Expand Down
2 changes: 1 addition & 1 deletion etl/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ def _get_attributes_from_step_name(step_name: str) -> Dict[str, str]:
if channel_type.startswith(("walden", "snapshot")):
channel = channel_type
namespace, version, short_name = path.split("/")
elif channel_type.startswith(("data", "backport")):
elif channel_type.startswith(("data",)):
channel, namespace, version, short_name = path.split("/")
else:
raise WrongStepName
Expand Down
Loading

0 comments on commit 15a7fd1

Please sign in to comment.