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

better way of configuring xcom parameters? #13

Open
benmackenzie-exos opened this issue Jan 10, 2020 · 4 comments
Open

better way of configuring xcom parameters? #13

benmackenzie-exos opened this issue Jan 10, 2020 · 4 comments

Comments

@benmackenzie-exos
Copy link
Contributor

benmackenzie-exos commented Jan 10, 2020

just add task_id, parameter pairs to airflow.cfg, e.g.,:

[export_xcom]
abc = cdf
all = rec_count

then change xcom_cofig:

def load_xcom_config():
"""Loads the XCom config if present."""
if "export_xcom" in conf._sections:
return conf._sections['export_xcom']
else:
return {}

I would go ahead and do this and make a pull request, but am uncomfortable access conf._sections directly....conf.getsection('export_xcom') seems to be the right way to do this, but it won't work if the section is not one of the defaults. Looks like a bug to me...any ideas?

@abhishekray07
Copy link

I am not entirely sure I understand what you mean? Could you explain the problem you are trying to solve?

@benmackenzie-exos
Copy link
Contributor Author

the problem is that in order to configure the xcom parameter exporter you need to go in an edit the config.yaml file. Which is a bit of a pain. It would be easier if the exporter got its configuration from the airflow.cfg file, which is accessible via conf._sections. My concern is that it seems wrong to access conf._sections directly. It seems like you should use conf.getsection...but this doesn't work.

@abhishekray07
Copy link

Yeah, I don't think adding anything to airflow.cfg would be appropriate since this exporter is installed as a plugin and this would create a weird circular dependency. Unfortunately, I don't have a good alternative either which might be easier to use. Ideally, a plugin like this just works out of the box without needing any to change any configurations or settings. That is the baseline for most people who use this plugin. If somebody needs more control, they can always go in and modify the configs.

@vanducng
Copy link

vanducng commented Feb 18, 2020

@benmackenzie-exos
I think you could change the directory storing config.yaml file to your AIRFLOW_HOME directory.
Simply make the modification to xcom_config.py

CONFIG_FILE = "/path/to/preferred/directory/config.yaml"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants