d04ddb6ababa39aa5b3171ec1675b1eee3bf4a40,polyaxon/checks/postgres.py,PostgresCheck,pg_health,#,9

Before Change


        with connection.cursor() as cursor:
            cursor.execute("SELECT 1; -- Healthcheck")
            health = cursor.fetchone()[0] == 1
            size = None
            if health:
                cursor.execute("select pg_database_size("postgres") as size")
                size = cursor.fetchone()
        return health, size

    @classmethod
    def run(cls):
        health, size = cls.pg_health()

After Change


                    cursor.execute("select pg_database_size("postgres") as size")
                    size = cursor.fetchone()
                    return Result(message="Service is healthy, db size {}".format(size))
            return Result(message="Service is not working.", severity=Result.WARNING)
        except Exception as e:
            return Result(message="Service unable to connect, encountered "{}" error.".format(e),
                          severity=Result.ERROR)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: polyaxon/polyaxon
Commit Name: d04ddb6ababa39aa5b3171ec1675b1eee3bf4a40
Time: 2018-10-05
Author: mouradmourafiq@gmail.com
File Name: polyaxon/checks/postgres.py
Class Name: PostgresCheck
Method Name: pg_health


Project Name: Netflix/vmaf
Commit Name: 306ed96034372cea725ceaa60e5ee177a7a6ce37
Time: 2016-02-24
Author: zli@netflix.com
File Name: python/quality_runner.py
Class Name: VmaftQualityRunner
Method Name: _run_on_asset


Project Name: Netflix/vmaf
Commit Name: 306ed96034372cea725ceaa60e5ee177a7a6ce37
Time: 2016-02-24
Author: zli@netflix.com
File Name: python/quality_runner.py
Class Name: VmafQualityRunner
Method Name: _run_on_asset