def test_currently_running(self):
     jf = self.mock_emr_job_flows['j-CURRENTLY_RUNNING']
     self.assertEqual(is_job_flow_done(jf), False)
     self.assertEqual(is_job_flow_running(jf), True)
     self.assertEqual(is_job_flow_non_streaming(jf), False)
     self.assertEqual(time_job_flow_idle(jf, self.now), timedelta(0))
     self.assertEqual(time_to_end_of_hour_for_job_flow(jf, self.now),
                      timedelta(minutes=45))
     self.assertEqual(job_flow_pool_name(jf), None)
 def test_currently_running(self):
     jf = self.mock_emr_job_flows['j-CURRENTLY_RUNNING']
     self.assertEqual(is_job_flow_done(jf), False)
     self.assertEqual(is_job_flow_running(jf), True)
     self.assertEqual(is_job_flow_non_streaming(jf), False)
     self.assertEqual(time_job_flow_idle(jf, self.now), timedelta(0))
     self.assertEqual(time_to_end_of_hour_for_job_flow(jf, self.now),
                      timedelta(minutes=45))
     self.assertEqual(job_flow_pool_name(jf), None)
    def test_idle_and_failed(self):
        jf = self.mock_emr_job_flows['j-IDLE_AND_FAILED']

        self.assertEqual(is_job_flow_done(jf), False)
        self.assertEqual(is_job_flow_running(jf), False)
        self.assertEqual(is_job_flow_non_streaming(jf), False)
        self.assertEqual(time_job_flow_idle(jf, self.now), timedelta(hours=3))
        self.assertEqual(time_to_end_of_hour_for_job_flow(jf, self.now),
                         timedelta(hours=1))
        self.assertEqual(job_flow_pool_name(jf), None)
    def test_hadoop_debugging_job_flow(self):
        jf = self.mock_emr_job_flows['j-HADOOP_DEBUGGING']

        self.assertEqual(is_job_flow_done(jf), False)
        self.assertEqual(is_job_flow_running(jf), False)
        self.assertEqual(is_job_flow_non_streaming(jf), False)
        self.assertEqual(time_job_flow_idle(jf, self.now), timedelta(hours=2))
        self.assertEqual(time_to_end_of_hour_for_job_flow(jf, self.now),
                         timedelta(hours=1))
        self.assertEqual(job_flow_pool_name(jf), None)
    def test_hive_job_flow(self):
        jf = self.mock_emr_job_flows['j-HIVE']

        self.assertEqual(is_job_flow_done(jf), False)
        self.assertEqual(is_job_flow_running(jf), False)
        self.assertEqual(is_job_flow_non_streaming(jf), True)
        self.assertEqual(time_job_flow_idle(jf, self.now), timedelta(hours=4))
        self.assertEqual(time_to_end_of_hour_for_job_flow(jf, self.now),
                         timedelta(hours=1))
        self.assertEqual(job_flow_pool_name(jf), None)
    def test_idle_and_failed(self):
        jf = self.mock_emr_job_flows['j-IDLE_AND_FAILED']

        self.assertEqual(is_job_flow_done(jf), False)
        self.assertEqual(is_job_flow_running(jf), False)
        self.assertEqual(is_job_flow_non_streaming(jf), False)
        self.assertEqual(time_job_flow_idle(jf, self.now), timedelta(hours=3))
        self.assertEqual(time_to_end_of_hour_for_job_flow(jf, self.now),
                         timedelta(hours=1))
        self.assertEqual(job_flow_pool_name(jf), None)
    def test_hadoop_debugging_job_flow(self):
        jf = self.mock_emr_job_flows['j-HADOOP_DEBUGGING']

        self.assertEqual(is_job_flow_done(jf), False)
        self.assertEqual(is_job_flow_running(jf), False)
        self.assertEqual(is_job_flow_non_streaming(jf), False)
        self.assertEqual(time_job_flow_idle(jf, self.now), timedelta(hours=2))
        self.assertEqual(time_to_end_of_hour_for_job_flow(jf, self.now),
                         timedelta(hours=1))
        self.assertEqual(job_flow_pool_name(jf), None)
    def test_hive_job_flow(self):
        jf = self.mock_emr_job_flows['j-HIVE']

        self.assertEqual(is_job_flow_done(jf), False)
        self.assertEqual(is_job_flow_running(jf), False)
        self.assertEqual(is_job_flow_non_streaming(jf), True)
        self.assertEqual(time_job_flow_idle(jf, self.now), timedelta(hours=4))
        self.assertEqual(time_to_end_of_hour_for_job_flow(jf, self.now),
                         timedelta(hours=1))
        self.assertEqual(job_flow_pool_name(jf), None)
    def test_pooled(self):
        jf = self.mock_emr_job_flows['j-POOLED']

        self.assertEqual(is_job_flow_done(jf), False)
        self.assertEqual(is_job_flow_running(jf), False)
        self.assertEqual(is_job_flow_non_streaming(jf), False)
        self.assertEqual(time_job_flow_idle(jf, self.now),
                         timedelta(minutes=55))
        self.assertEqual(time_to_end_of_hour_for_job_flow(jf, self.now),
                         timedelta(minutes=5))
        self.assertEqual(job_flow_pool_name(jf), 'reflecting')
    def test_pooled(self):
        jf = self.mock_emr_job_flows['j-POOLED']

        self.assertEqual(is_job_flow_done(jf), False)
        self.assertEqual(is_job_flow_running(jf), False)
        self.assertEqual(is_job_flow_non_streaming(jf), False)
        self.assertEqual(time_job_flow_idle(jf, self.now),
                         timedelta(minutes=55))
        self.assertEqual(time_to_end_of_hour_for_job_flow(jf, self.now),
                         timedelta(minutes=5))
        self.assertEqual(job_flow_pool_name(jf), 'reflecting')