From b44f4ca30667b582e589323a788f57c7ded336f4 Mon Sep 17 00:00:00 2001 From: prha Date: Thu, 26 Jan 2023 16:28:25 -0800 Subject: [PATCH] fix formatting --- .../dagster-mysql/dagster_mysql/event_log/event_log.py | 4 +++- .../dagster_mysql/run_storage/run_storage.py | 8 ++++++-- .../dagster_mysql/schedule_storage/schedule_storage.py | 4 +++- .../libraries/dagster-mysql/dagster_mysql/utils.py | 4 +++- .../dagster-mysql/dagster_mysql_tests/test_run_storage.py | 2 +- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/python_modules/libraries/dagster-mysql/dagster_mysql/event_log/event_log.py b/python_modules/libraries/dagster-mysql/dagster_mysql/event_log/event_log.py index fde850bca785b..0fba7e467c1f8 100644 --- a/python_modules/libraries/dagster-mysql/dagster_mysql/event_log/event_log.py +++ b/python_modules/libraries/dagster-mysql/dagster_mysql/event_log/event_log.py @@ -195,7 +195,9 @@ def end_watch(self, run_id, handler): @property def supports_intersect(self): - return parse_mysql_version(self._mysql_version) >= parse_mysql_version(MINIMUM_MYSQL_INTERSECT_VERSION) + return parse_mysql_version(self._mysql_version) >= parse_mysql_version( + MINIMUM_MYSQL_INTERSECT_VERSION + ) @property def event_watcher(self): diff --git a/python_modules/libraries/dagster-mysql/dagster_mysql/run_storage/run_storage.py b/python_modules/libraries/dagster-mysql/dagster_mysql/run_storage/run_storage.py index 8ac4610df758f..4307dec140e92 100644 --- a/python_modules/libraries/dagster-mysql/dagster_mysql/run_storage/run_storage.py +++ b/python_modules/libraries/dagster-mysql/dagster_mysql/run_storage/run_storage.py @@ -154,11 +154,15 @@ def supports_bucket_queries(self): if not self._mysql_version: return False - return parse_mysql_version(self._mysql_version) >= parse_mysql_version(MINIMUM_MYSQL_BUCKET_VERSION) + return parse_mysql_version(self._mysql_version) >= parse_mysql_version( + MINIMUM_MYSQL_BUCKET_VERSION + ) @property def supports_intersect(self): - return parse_mysql_version(self._mysql_version) >= parse_mysql_version(MINIMUM_MYSQL_INTERSECT_VERSION) + return parse_mysql_version(self._mysql_version) >= parse_mysql_version( + MINIMUM_MYSQL_INTERSECT_VERSION + ) def add_daemon_heartbeat(self, daemon_heartbeat): with self.connect() as conn: diff --git a/python_modules/libraries/dagster-mysql/dagster_mysql/schedule_storage/schedule_storage.py b/python_modules/libraries/dagster-mysql/dagster_mysql/schedule_storage/schedule_storage.py index 7e9000f46b6ba..4149b0a730d81 100644 --- a/python_modules/libraries/dagster-mysql/dagster_mysql/schedule_storage/schedule_storage.py +++ b/python_modules/libraries/dagster-mysql/dagster_mysql/schedule_storage/schedule_storage.py @@ -117,7 +117,9 @@ def supports_batch_queries(self): if not self._mysql_version: return False - return parse_mysql_version(self._mysql_version) >= parse_mysql_version(MINIMUM_MYSQL_BATCH_VERSION) + return parse_mysql_version(self._mysql_version) >= parse_mysql_version( + MINIMUM_MYSQL_BATCH_VERSION + ) def get_server_version(self): rows = self.execute("select version()") diff --git a/python_modules/libraries/dagster-mysql/dagster_mysql/utils.py b/python_modules/libraries/dagster-mysql/dagster_mysql/utils.py index 9167e8059d1fc..c77678b497d92 100644 --- a/python_modules/libraries/dagster-mysql/dagster_mysql/utils.py +++ b/python_modules/libraries/dagster-mysql/dagster_mysql/utils.py @@ -46,6 +46,7 @@ def get_conn_string(username, password, hostname, db_name, port="3306"): port=port, ) + def parse_mysql_version(version: str) -> tuple[int]: """Parse MySQL version into a tuple of ints. @@ -56,7 +57,7 @@ def parse_mysql_version(version: str) -> tuple[int]: tuple: Tuple of ints representing the MySQL version. """ parsed = [] - for part in re.split(r'\D+', version): + for part in re.split(r"\D+", version): if len(part) == 0: continue try: @@ -65,6 +66,7 @@ def parse_mysql_version(version: str) -> tuple[int]: continue return tuple(parsed) + def retry_mysql_creation_fn(fn, retry_limit=5, retry_wait=0.2): # Retry logic to recover from the case where two processes are creating # tables at the same time using sqlalchemy diff --git a/python_modules/libraries/dagster-mysql/dagster_mysql_tests/test_run_storage.py b/python_modules/libraries/dagster-mysql/dagster_mysql_tests/test_run_storage.py index f65b6a1c4a46c..54c66a736e07f 100644 --- a/python_modules/libraries/dagster-mysql/dagster_mysql_tests/test_run_storage.py +++ b/python_modules/libraries/dagster-mysql/dagster_mysql_tests/test_run_storage.py @@ -100,4 +100,4 @@ def get_server_version(self): return "8.0.31-google" storage = FakeBucketing(conn_string) - assert storage.supports_bucket_queries \ No newline at end of file + assert storage.supports_bucket_queries