Untitled

mail@pastecode.io avatar
unknown
plain_text
10 months ago
3.4 kB
2
Indexable
Never
Code:
def collect_ams_engine_version_logs(self, instance_id, workflow_path):
        """
        Gather ams engine versions
        """
        credentials = self.get_pas_credentials(PAS_ADMIN_OPS_ROLE)
        cmds = self.get_rds_s3_file_transfer_template(
            credentials["AccessKeyId"], credentials["SecretAccessKey"]
        )
        # cmds.append(
        #     "aws s3 cp " + f"{self.base_s3_location}/aurora-db-logs/get-engine-commit.sh /tmp "
        # )
        cmds.append('sudo date > /tmp/engine_commit_id.log 2>&1')
        cmds.append(
        '/rdsdbbin/oscar/bin/mysql -u rdsbmsperf -p auroraperf -e "SELECT aurora_version();" -prdsbmsperf | grep -P \'[\d.]+\' >> /tmp/engine_commit_id.log 2>&1'
    )
        cmds.append(
        'MySQL_grep=$(echo $(strings /rdsdbbin/oscar/bin/mysqld | grep \'git-head\' -m1))'
    )
        cmds.append(
        'engine_internal_version=$(echo $MySQL_grep | grep -P \'OscarMysql[\d]+-[\d.]+' '-o | grep -P \'[\d.]+\' >> /tmp/engine_commit_id.log 2>&1)'
    )
        cmds.append(
        'engine_build_time=$(echo $MySQL_grep | grep -P \'\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}UTC\' -o >> /tmp/engine_commit_id.log 2>&1)'
    )
        cmds.append(
        'engine_git_commit=$(echo $MySQL_grep | grep -P \'[\w\d]{40}\' -o -m1 >> /tmp/engine_commit_id.log 2>&1)'
    )
        # cmds.append("sudo chmod +x /tmp/get-engine-commit.sh")
        # cmds.append("sudo bash /tmp/get-engine-commit.sh > /tmp/engine_commit_id.log 2>&1")
        cmds.append(
        'aws s3 cp /tmp/engine_commit_id.log '
        + f"{get_pas_logs_s3_dir_for_instance(workflow_path, instance_id[0].strip())}"
    )

        self.__ssm_client.run_cmd(
        instance_id[1],
        cmds,
    )


Error
[CPython38-release] Running flake8
[CPython38-release] src/aurora_performance_data_service/helpers/log_utils/log_collection.py:226:125: W605 invalid escape sequence '\d'
[CPython38-release] src/aurora_performance_data_service/helpers/log_utils/log_collection.py:232:79: W605 invalid escape sequence '\d'
[CPython38-release] src/aurora_performance_data_service/helpers/log_utils/log_collection.py:232:85: W605 invalid escape sequence '\d'
[CPython38-release] src/aurora_performance_data_service/helpers/log_utils/log_collection.py:233:29: W605 invalid escape sequence '\d'
[CPython38-release] src/aurora_performance_data_service/helpers/log_utils/log_collection.py:236:62: W605 invalid escape sequence '\d'
[CPython38-release] src/aurora_performance_data_service/helpers/log_utils/log_collection.py:236:68: W605 invalid escape sequence '\d'
[CPython38-release] src/aurora_performance_data_service/helpers/log_utils/log_collection.py:236:74: W605 invalid escape sequence '\d'
[CPython38-release] src/aurora_performance_data_service/helpers/log_utils/log_collection.py:236:80: W605 invalid escape sequence '\d'
[CPython38-release] src/aurora_performance_data_service/helpers/log_utils/log_collection.py:236:86: W605 invalid escape sequence '\d'
[CPython38-release] src/aurora_performance_data_service/helpers/log_utils/log_collection.py:236:92: W605 invalid escape sequence '\d'
[CPython38-release] src/aurora_performance_data_service/helpers/log_utils/log_collection.py:239:63: W605 invalid escape sequence '\w'
[CPython38-release] src/aurora_performance_data_service/helpers/log_utils/log_collection.py:239:65: W605 invalid escape sequence '\d'
Leave a Comment