[GitHub] [airflow] potiuk commented on a change in pull request #7172: [AIRFLOW-6564] Additional diagnostics information on CI check failure

2020-01-15 Thread GitBox
potiuk commented on a change in pull request #7172: [AIRFLOW-6564] Additional 
diagnostics information on CI check failure
URL: https://github.com/apache/airflow/pull/7172#discussion_r367118737
 
 

 ##
 File path: airflow/bin/cli.py
 ##
 @@ -837,6 +837,12 @@ class CLIFactory:
 'help': "Runs a shell to access the database",
 'args': tuple(),
 },
+{
+'func': lazy_load_command('airflow.cli.commands.db_command.check'),
+'name': 'check',
+'help': "Chack if the database can be reached.",
 
 Review comment:
   Right!


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [airflow] potiuk commented on a change in pull request #7172: [AIRFLOW-6564] Additional diagnostics information on CI check failure

2020-01-15 Thread GitBox
potiuk commented on a change in pull request #7172: [AIRFLOW-6564] Additional 
diagnostics information on CI check failure
URL: https://github.com/apache/airflow/pull/7172#discussion_r367118278
 
 

 ##
 File path: airflow/utils/db.py
 ##
 @@ -501,3 +501,13 @@ def resetdb():
 Base.metadata.drop_all(connection)  # pylint: disable=no-member
 
 initdb()
+
+
+@provide_session
+def check(session=None):
+"""
+Checks if the database works.
+:param session: session of the sqlalchemy
+"""
+session.execute('select 1 as is_alive;')
+log.info("Connection successful.")
 
 Review comment:
   Again - we do not have neither scheduler nor webserver nor any of the 
workers. It's just checking if the environment we have is "sane" - i.e. if the 
databases are there and can be queried, if all the integration for CI tests are 
reachable at the destination endpoints. 
   
   We explicitly only check database availability before we start tests.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [airflow] potiuk commented on a change in pull request #7172: [AIRFLOW-6564] Additional diagnostics information on CI check failure

2020-01-15 Thread GitBox
potiuk commented on a change in pull request #7172: [AIRFLOW-6564] Additional 
diagnostics information on CI check failure
URL: https://github.com/apache/airflow/pull/7172#discussion_r367117375
 
 

 ##
 File path: airflow/bin/cli.py
 ##
 @@ -837,6 +837,12 @@ class CLIFactory:
 'help': "Runs a shell to access the database",
 'args': tuple(),
 },
+{
+'func': lazy_load_command('airflow.cli.commands.db_command.check'),
+'name': 'check',
+'help': "Chack if the database can be reached.",
+'args': tuple(),
+},
 
 Review comment:
   But we do not run webserver nor airflow at this point yet. It's just 
environment we check.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [airflow] potiuk commented on a change in pull request #7172: [AIRFLOW-6564] Additional diagnostics information on CI check failure

2020-01-15 Thread GitBox
potiuk commented on a change in pull request #7172: [AIRFLOW-6564] Additional 
diagnostics information on CI check failure
URL: https://github.com/apache/airflow/pull/7172#discussion_r367089560
 
 

 ##
 File path: airflow/utils/db.py
 ##
 @@ -501,3 +501,13 @@ def resetdb():
 Base.metadata.drop_all(connection)  # pylint: disable=no-member
 
 initdb()
+
+
+@provide_session
+def check(session=None):
+"""
+Checks if the database works.
+@param session: session of the sqlalchemy
 
 Review comment:
   Right!


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [airflow] potiuk commented on a change in pull request #7172: [AIRFLOW-6564] Additional diagnostics information on CI check failure

2020-01-15 Thread GitBox
potiuk commented on a change in pull request #7172: [AIRFLOW-6564] Additional 
diagnostics information on CI check failure
URL: https://github.com/apache/airflow/pull/7172#discussion_r367088868
 
 

 ##
 File path: airflow/utils/db.py
 ##
 @@ -501,3 +501,13 @@ def resetdb():
 Base.metadata.drop_all(connection)  # pylint: disable=no-member
 
 initdb()
+
+
+@provide_session
+def check(session=None):
+"""
+Checks if the database works.
+@param session: session of the sqlalchemy
+"""
+session.execute('select 1 as is_alive;')
 
 Review comment:
   It throws an exception :). Which in turn exits with non-zero exit code :)


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [airflow] potiuk commented on a change in pull request #7172: [AIRFLOW-6564] Additional diagnostics information on CI check failure

2020-01-15 Thread GitBox
potiuk commented on a change in pull request #7172: [AIRFLOW-6564] Additional 
diagnostics information on CI check failure
URL: https://github.com/apache/airflow/pull/7172#discussion_r367088641
 
 

 ##
 File path: airflow/jobs/scheduler_job.py
 ##
 @@ -990,7 +990,8 @@ def _change_state_for_tis_without_dagrun(self,
 .with_for_update() \
 .all()
 for ti in tis_to_change:
-ti.set_state(new_state, session=session)
+ti.set_state(new_state,
 
 Review comment:
   Ah yeah. it was accidental! Thanks!


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services