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

Variable import failed -- used CLI method #38

Open
pranavpawar3 opened this issue Jun 29, 2020 · 0 comments
Open

Variable import failed -- used CLI method #38

pranavpawar3 opened this issue Jun 29, 2020 · 0 comments

Comments

@pranavpawar3
Copy link

pranavpawar3 commented Jun 29, 2020

Hi,

I have created a variables.json file to be loaded for my dags, the file is as follows

{
	"variables_config": {
		"run_name": "run_v5.0",
		"model_name": "bert-base-uncased",
		"model_type": "bert"
	}
}

When I try to import this variable file using CLI, the following error is generated --

[2020-06-29 14:36:02,949] {{cli_action_loggers.py:107}} WARNING - Failed to log action with (psycopg2.errors.UndefinedTable) relation "log" does not exist
LINE 1: INSERT INTO log (dttm, dag_id, task_id, event, execution_dat...
                    ^

[SQL: INSERT INTO log (dttm, dag_id, task_id, event, execution_date, owner, extra) VALUES (%(dttm)s, %(dag_id)s, %(task_id)s, %(event)s, %(execution_date)s, %(owner)s, %(extra)s) RETURNING log.id]
[parameters: {'dttm': datetime.datetime(2020, 6, 29, 14, 36, 2, 937905, tzinfo=<Timezone [UTC]>), 'dag_id': None, 'task_id': None, 'event': 'cli_variables', 'execution_date': None, 'owner': 'airflow', 'extra': '{"host_name": "903358252eab", "full_command": "[\'/usr/local/bin/airflow\', \'variables\', \'--import\', \'/usr/local/airflow/dags/config/variables.json\']"}'}]
(Background on this error at: http://sqlalche.me/e/13/f405)
Variable import failed: ProgrammingError('(psycopg2.errors.UndefinedTable) relation "variable" does not exist\nLINE 1: DELETE FROM variable WHERE variable.key = \'variables_config\'\n                    ^\n')
0 of 1 variables successfully updated.
1 variable(s) failed to be updated.

Command used -

docker-compose run --rm webserver airflow variables --import /usr/local/airflow/dags/config/variables.json

Code to access the variables -

default_args = {
    'owner': 'airflow',
    'start_date': airflow.utils.dates.days_ago(1),# dt.datetime(2020, 6, 25),
    'concurrency': 1,
    'retries': 0,
    'schedule_interval':'@once'
}
dag_config = Variable.get("variables_config", deserialize_json=True)

run_name = dag_config["run_name"]
model_name = dag_config["model_name"]
model_type = dag_config["model_type"]

Can you help out with this issue?

P.S. I have forked the repo here, changed the volume mappings for custom use.

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

1 participant