# Path: chaosmonkey/planners/planner.py
# class Planner:
#     """
#     Planner interface
#     Planners are responsible for scheduling jobs that executes attacks
# 
#     :param name:    plan name
#     """
# 
#     ref = None  # must override
#     schema = None  # must override
#     example = None  # must override
# 
#     def __init__(self, name):
#         self.name = name
# 
#     def plan(self, planner_config, attack_config):
#         """
#         Plan the jobs.
#         This method should use the config to schedule jobs based on the
#         configuration for the planner
# 
#         :param planner_config:    configuration related to the scheduler
#         :param attack_config:   configuration related to the attack
#         """
#         raise NotImplementedError("Plans should implement this!")
# 
#     @staticmethod
#     def add_plan(name):
#         return manager.add_plan(name)
# 
#     @staticmethod
#     def _add_executor(date, name, attack_config, plan_id):
#         """
#         Add a job to the global scheduler
# 
#         :param date: date to execute the job
#         :param name: job name
#         :param attack_config: configuration related to the attack
#         """
#         date_timezone = manager.scheduler.timezone.localize(date)
#         manager.add_executor(date_timezone, name, attack_config, plan_id)
# 
#     @staticmethod
#     def to_dict():
#         raise NotImplementedError("Planners should implement this!")
# 
#     @staticmethod
#     def _to_dict(ref, schema, example):
#         return {
#             "ref": ref,
#             "schema": schema,
#             "example": example,
#         }


import logging
import arrow
from chaosmonkey.planners.planner import Planner
            "ref": {"type": "string"},
            "args": {
                "type": "object",
                "properties": {
                    "date": {"type": "string"}
                }
            }
        }
    }
    example = {
        "ref": "exact_planner:ExactPlanner",
        "args": {
            "date": "2016-06-21T15:30:00"
        }
    }

    def __init__(self, name):
        super(ExactPlanner, self).__init__(name)

        self.log = logging.getLogger(__name__)

    def plan(self, planner_config, attack_config):
        plan = self.add_plan(self.name)

        attack_date = arrow.get(planner_config["args"]["date"]).datetime.replace(tzinfo=None)
        self.log.info("Exact Planner in %s", attack_date)
        self._add_executor(attack_date, self.name, attack_config, plan.id)

    @staticmethod
    def to_dict():

# Path: chaosmonkey/planners/planner.py
# class Planner:
#     """
#     Planner interface
#     Planners are responsible for scheduling jobs that executes attacks
# 
#     :param name:    plan name
#     """
# 
#     ref = None  # must override
#     schema = None  # must override
#     example = None  # must override
# 
#     def __init__(self, name):
#         self.name = name
# 
#     def plan(self, planner_config, attack_config):
#         """
#         Plan the jobs.
#         This method should use the config to schedule jobs based on the
#         configuration for the planner
# 
#         :param planner_config:    configuration related to the scheduler
#         :param attack_config:   configuration related to the attack
#         """
#         raise NotImplementedError("Plans should implement this!")
# 
#     @staticmethod
#     def add_plan(name):
#         return manager.add_plan(name)
# 
#     @staticmethod
#     def _add_executor(date, name, attack_config, plan_id):
#         """
#         Add a job to the global scheduler
# 
#         :param date: date to execute the job
#         :param name: job name
#         :param attack_config: configuration related to the attack
#         """
#         date_timezone = manager.scheduler.timezone.localize(date)
#         manager.add_executor(date_timezone, name, attack_config, plan_id)
# 
#     @staticmethod
#     def to_dict():
#         raise NotImplementedError("Planners should implement this!")
# 
#     @staticmethod
#     def _to_dict(ref, schema, example):
#         return {
#             "ref": ref,
#             "schema": schema,
#             "example": example,
#         }


# Path: planners/exact_planner.py
import logging
import arrow
from chaosmonkey.planners.planner import Planner

            "ref": {"type": "string"},
            "args": {
                "type": "object",
                "properties": {
                    "date": {"type": "string"}
                }
            }
        }
    }
    example = {
        "ref": "exact_planner:ExactPlanner",
        "args": {
            "date": "2016-06-21T15:30:00"
        }
    }

    def __init__(self, name):
        super(ExactPlanner, self).__init__(name)

        self.log = logging.getLogger(__name__)

    def plan(self, planner_config, attack_config):
        plan = self.add_plan(self.name)

        attack_date = arrow.get(planner_config["args"]["date"]).datetime.replace(tzinfo=None)
        self.log.info("Exact Planner in %s", attack_date)
        self._add_executor(attack_date, self.name, attack_config, plan.id)

    @staticmethod
    def to_dict():

        return Planner._to_dict(ExactPlanner.ref, ExactPlanner.schema, ExactPlanner.example)