Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features/#59 move resource management to importlib resources #119

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
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
13 changes: 11 additions & 2 deletions src/egon/data/airflow/dags/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,25 @@
import egon.data.processing.openstreetmap as process_osm
import egon.data.importing.zensus as import_zs

from importlib_resources import files
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a third party library import. According to "CONTRIBUTING.rst" this should be placed in a section between builtin imports and package local imports. But I see that others messed up the import order before you already.
Also, the importlib-resources package should be added to the depen dencies in "setup.py".

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! thanks.


# Prepare connection to db for operators
airflow_db_connection()

print('*-*-*-*-*-*')
print(os.path.abspath(os.path.join(os.path.dirname(
__file__ ), '..', '..', 'processing', 'vg250')))
print(files('egon.data.processing').joinpath('vg250'))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you removed those changes in a later commit, I think you committed them by accident and know that such debug statements usually shouldn't be part of published commits. But now that I see how you used those statements, let me point out, that you could also have tried them out in an interactive console session, obviating the need to write them into a file in the first place.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.


with airflow.DAG(
"egon-data-processing-pipeline",
description="The eGo^N data processing DAG.",
default_args={"start_date": days_ago(1)},
template_searchpath=[
os.path.abspath(os.path.join(os.path.dirname(
__file__ ), '..', '..', 'processing', 'vg250'))
#os.path.abspath(os.path.join(os.path.dirname(
# __file__ ), '..', '..', 'processing', 'vg250'))
files('egon.data.processing').joinpath('vg250')

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think files('egon.data.processing.vg250') should do the same.

],
is_paused_upon_creation=False,
schedule_interval=None,
Expand Down