예제 #1
0
def __init_schedule_jobs():
    """Init scheduled jobs in fact"""
    log.debug("init scheduled jobs......")

    util = RequiredFeature("util")
    sche = RequiredFeature("scheduler")
    if not util.is_local():
        hackathon_manager = RequiredFeature("hackathon_manager")
        # host_server_manager = RequiredFeature("docker_host_manager")

        # schedule job to check recycle operation
        next_run_time = util.get_now() + timedelta(seconds=10)
        sche.add_interval(feature="expr_manager",
                          method="scheduler_recycle_expr",
                          id="scheduler_recycle_expr",
                          next_run_time=next_run_time,
                          minutes=10)

        # schedule job to pre-allocate environment
        hackathon_manager.schedule_pre_allocate_expr_job()

        # # schedule job to pull docker images automatically
        # if not safe_get_config("docker.alauda.enabled", False):
        #     docker = RequiredFeature("hosted_docker")
        #     docker.ensure_images()

        # schedule job to pre-create a docker host server VM
        # host_server_manager.schedule_pre_allocate_host_server_job()

    # init the overtime-sessions detection to update users' online status
    sche.add_interval(feature="user_manager",
                      method="check_user_online_status",
                      id="check_user_online_status",
                      minutes=10)
예제 #2
0
def __init_schedule_jobs():
    """Init scheduled jobs in fact"""
    log.debug("init scheduled jobs......")

    util = RequiredFeature("util")
    sche = RequiredFeature("scheduler")
    if not util.is_local():
        hackathon_manager = RequiredFeature("hackathon_manager")

        # schedule job to check recycle operation
        next_run_time = util.get_now() + timedelta(seconds=10)
        sche.add_interval(feature="expr_manager",
                          method="scheduler_recycle_expr",
                          id="scheduler_recycle_expr",
                          next_run_time=next_run_time,
                          minutes=10)

        # schedule job to pre-allocate environment
        hackathon_manager.schedule_pre_allocate_expr_job()

        # schedule job to pull docker images automatically
        #if not safe_get_config("docker.alauda.enabled", False):
        #     docker = RequiredFeature("hosted_docker_proxy")
        #     docker.ensure_images()

        # schedule job to pre-create a docker host server VM
        #host_server_manager.schedule_pre_allocate_host_server_job()
    # init the overtime-sessions detection to update users' online status
    sche.add_interval(feature="user_manager",
                      method="check_user_online_status",
                      id="check_user_online_status",
                      minutes=10)