Пример #1
0
    def build(self, args, startdate, enddate):
        equiv_patternA = name_mapping()
        sA = []
        sA.append("SELECT CASE ")
        for entry in equiv_patternA:
            left = entry[0].lower()
            right = entry[1]
            s = "WHEN LOWER(SUBSTRING_INDEX(xalt_run.exec_path,'/',-1)) REGEXP '%s' then '%s' " % (
                left, right)
            sA.append(s)

        sA.append(" ELSE SUBSTRING_INDEX(xalt_run.exec_path,'/',-1) END ")
        sA.append(
            " AS execname, ROUND(SUM(run_time*num_cores/3600)) as totalcput, ")
        sA.append(" COUNT(date) as n_jobs, COUNT(DISTINCT(user)) as n_users ")
        sA.append("   FROM xalt_run ")
        sA.append("  WHERE syshost like '%s' ")
        sA.append("    AND date >= '%s' AND date < '%s' ")
        sA.append("  GROUP BY execname ORDER BY totalcput DESC")

        query = "".join(sA) % (args.syshost, startdate, enddate)
        cursor = self.__cursor

        cursor.execute(query)
        resultA = cursor.fetchall()

        execA = self.__execA
        for execname, corehours, n_jobs, n_users in resultA:
            entryT = {
                'execname': execname,
                'corehours': corehours,
                'n_jobs': n_jobs,
                'n_users': n_users
            }
            execA.append(entryT)
Пример #2
0
  def build(self, args, startdate, enddate):
    equiv_patternA = name_mapping()
    sA = []
    sA.append("SELECT CASE ")
    for entry in equiv_patternA:
      left  = entry[0].lower()
      right = entry[1]
      s     = "WHEN LOWER(SUBSTRING_INDEX(xalt_run.exec_path,'/',-1)) REGEXP '%s' then '%s' " % (left, right)
      sA.append(s)

    sA.append(" ELSE SUBSTRING_INDEX(xalt_run.exec_path,'/',-1) END ")
    sA.append(" AS execname, ROUND(SUM(run_time*num_cores/3600)) as totalcput, ")
    sA.append(" COUNT(date) as n_jobs, COUNT(DISTINCT(user)) as n_users ")
    sA.append("   FROM xalt_run ")
    sA.append("  WHERE syshost like '%s' ")
    sA.append("    AND date >= '%s' AND date < '%s' ")
    sA.append("  GROUP BY execname ORDER BY totalcput DESC")

    query  = "".join(sA) % (args.syshost, startdate, enddate)
    cursor = self.__cursor

    cursor.execute(query)
    resultA = cursor.fetchall()

    execA = self.__execA
    for execname, corehours, n_jobs, n_users in resultA:
      entryT = {'execname'  : execname,
                'corehours' : corehours,
                'n_jobs'    : n_jobs,
                'n_users'   : n_users}
      execA.append(entryT)
Пример #3
0
    def build(self, args, style, start_date, end_date):
        equiv_patternA = name_mapping()
        sA = []
        sA.append("SELECT CASE ")
        for entry in equiv_patternA:
            left = entry[0].lower()
            right = entry[1]
            s = "WHEN LOWER(SUBSTRING_INDEX(xalt_run.exec_path,'/',-1)) REGEXP '%s' then '%s' " % (
                left, right)
            sA.append(s)

        sA.append(" ELSE SUBSTRING_INDEX(xalt_run.exec_path,'/',-1) END ")
        sA.append(
            " AS execname, ROUND(SUM(run_time*num_cores/3600)) as totalcput, ")
        sA.append(
            " COUNT(date) as n_runs, COUNT(DISTINCT(user)) as n_users, ", )
        sA.append(" COUNT(DISTINCT(account)) as n_accts ", )
        sA.append("   FROM xalt_run ")
        sA.append("  WHERE syshost like '%s' ")
        sA.append("    AND queue like '%s' ")
        sA.append("    AND date >= '%s' AND date < '%s' ")
        if (style == 'Scalar' or style == 'Non-MPI'):
            sA.append("    AND num_cores <= '1' ")
        elif (style == 'Scalar_05'):
            sA.append("    AND num_cores <= '1' ")
            sA.append("    AND run_time < '300.0' ")
        elif (style == 'Scalar_10'):
            sA.append("    AND num_cores <= '1' ")
            sA.append("    AND run_time < '600.0' ")
        elif (style == 'Scalar_20'):
            sA.append("    AND num_cores <= '1' ")
            sA.append("    AND run_time < '1200.0' ")
        elif (style == 'Scalar_30'):
            sA.append("    AND num_cores <= '1' ")
            sA.append("    AND run_time < '1800.0' ")
        elif (style == 'MPI'):
            sA.append("    AND num_cores > '1' ")
        sA.append("  GROUP BY execname ORDER BY totalcput DESC")

        query = "".join(sA) % (args.syshost, args.queue, start_date, end_date)
        cursor = self.__cursor

        cursor.execute(query)
        resultA = cursor.fetchall()

        execA = self.__execA
        for execname, corehours, n_runs, n_users, n_accts in resultA:
            entryT = {
                'execname': execname,
                'corehours': corehours,
                'n_runs': n_runs,
                'n_users': n_users,
                'n_accts': n_accts
            }
            execA.append(entryT)
Пример #4
0
    def build(self, args, start_date, end_date, compiler):
        equiv_patternA = name_mapping()
        sA = []
        sA.append("SELECT CASE ")
        for entry in equiv_patternA:
            left = entry[0].lower()
            right = entry[1]
            s = "WHEN LOWER(SUBSTRING_INDEX(t1.exec_path,'/',-1)) REGEXP '%s' then '%s' " % (
                left, right)
            sA.append(s)

        sA.append(" ELSE SUBSTRING_INDEX(t1.exec_path,'/',-1) END ")
        sA.append(
            " AS execname, ROUND(SUM(t1.run_time*t1.num_cores/3600)) as totalcput, "
        )
        sA.append(
            " COUNT(t1.date) as n_runs, COUNT(DISTINCT(t1.user)) as n_users,")
        sA.append(" COUNT(DISTINCT(t1.account)) as n_accts")
        sA.append("   FROM xalt_run as t1, xalt_link as t2 ")
        sA.append("  WHERE t1.syshost like '%s' ")
        sA.append("    AND t1.date >= '%s' AND t1.date < '%s' ")
        sA.append("    AND t1.uuid = t2.uuid")
        sA.append("    AND t2.link_program = '%s' ")
        sA.append("  GROUP BY execname ORDER BY totalcput DESC")

        query = "".join(sA) % (args.syshost, start_date, end_date, compiler)
        cursor = self.__cursor

        cursor.execute(query)
        resultA = cursor.fetchall()

        execA = self.__execA
        for execname, corehours, n_runs, n_users, n_accts in resultA:
            entryT = {
                'execname': execname,
                'corehours': corehours,
                'n_runs': n_runs,
                'n_users': n_users,
                'n_accts': n_accts
            }
            execA.append(entryT)