Exemple #1
0
from Config_Overrides import Config_Overrides
from Property_Overrides import Property_Overrides
from Benchmark_Configs import Benchmark_Configs
from Benchmark_run import Benchmark_run
from Job import Job
import CLperfDB

config_overrides = Config_Overrides.choose_random_config_overrides()
property_overrides = Property_Overrides.choose_random_property_overrides()
benchmark_configs = Benchmark_Configs.default_run_server_name_only(
    'clperftesting-gen5-bc8-loose24-neu-00.neu187d1a144a72d.sqltest-eg1.mscds.com'
)
connection = CLperfDB.connect()
run = Benchmark_run(connection, config_overrides, property_overrides,
                    benchmark_configs)

print(run)

runs = [run]
job = Job(connection, 'Dubravka_external_schedule', runs,
          'scheduling from Python')
success = CLperfDB.schedule_job(job)

print(success)
SLEEP_FOR_RESULTS = 1
NUMBER_OF_JOBS = 1  #I suppose this won't be convergence condition

if __name__ == "__main__":

    connection = CLperfDB.connect()

    with open("first_job.json", "r+") as starting_job_file:
        starting_job_configs = starting_job_file.read()

        job = Job(connection, "Dummy job", starting_job_configs,
                  "First job scheduled from Python")

        number_of_finished_jobs = 0
        job_results = []

        while number_of_finished_jobs < NUMBER_OF_JOBS:  #I suppose this won't be convergence condition

            CLperfDB.schedule_job(job)
            next_job = brain.decide_for_next_job(
                connection, job, job_results
            )  #maybe this will decide for list of jobs, not one job...

            while not CLperfDB.is_job_finished(job):
                time.sleep(SLEEP_FOR_RESULTS)

            number_of_finished_jobs += 1

            job_results = CLperfDB.read_results_with_benchmarks_id(job)
            job = next_job