Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
2.0 kB
2
Indexable
Never
My code
class RDSHostLogCollection(__BaseLogCollection):
    def __init__(self, domain, region, perf_workflow_config: PerfWorkflowConfig, **kwargs):
        super().__init__(**kwargs)
        self.pwc = perf_workflow_config
        self.workflow_config = self.pwc.rdsbms_params_dict
        self.__ssm_client = get_ssm_client(region=region, rds_domain=domain)

 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"]
        )
        dbname1 = self.workflow_config["db_name"]
        dbpassword1 = self.workflow_config["db_password"]
        dbuser1 = self.workflow_config["db_user"]
        print(dbname1)

        # dbname1 = "auroraperf"
        # dbpassword1 = "rdsbmsperf"
        # dbuser1 = "rdsbmsperf"
 
        cmds.append("export logfile=/tmp/engine_commit_id.log")
        cmds.append("sudo date >> $logfile 2>&1")

        cmds.append(
            f"engine_public_version=$(/rdsdbbin/oscar/bin/mysql --user={dbuser1} --database={dbname1} -e \"SELECT aurora_version();\" --password={dbpassword1} | grep -oP '[\\d.]+' | tr -d '\\n')"
        )

        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.]+' | tr -d '\\n');"
        )
        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 | tr -d '\\n');"
        )

Now how to modify this run function?


def get_custom_log_collection(domain, region):
    return RDSHostLogCollection(domain, region)


as I have added a new function parameter
Leave a Comment