def get_data_for_train_stages(self, sc_regular, sc_first_model, sc_second_model, relevant_anomalous_metrics, max_incident_creation_timestamp, last_fit_timestamp, agg_minutes, max_request_timestamp):
    ids_to_exclude = self.get_request_ids_from_incidents(incident_status=['incident'], relevant_anomalous_metrics=relevant_anomalous_metrics, max_incident_creation_timestamp=max_incident_creation_timestamp)
    if (max_request_timestamp is not None):
        max_request_timestamp = (max_request_timestamp.timestamp() * 1000)
    if (last_fit_timestamp is not None):
        last_fit_timestamp = (last_fit_timestamp.timestamp() * 1000)
    data_regular = pd.DataFrame()
    data_first_train = pd.DataFrame()
    data_first_retrain = pd.DataFrame()
    if (len(sc_first_model) > 0):
        if (len(sc_first_model) > 100):
            data_first_train = self.aggregate_data_for_historic_averages_model(agg_minutes=agg_minutes, end_time=max_request_timestamp)
            if (len(data_first_train) > 0):
                data_first_train = data_first_train.merge(sc_first_model[self._config.service_call_fields])
        else:
            data_first_train = self.aggregate_data_for_historic_averages_model(agg_minutes=agg_minutes, end_time=max_request_timestamp, service_calls=sc_first_model[self._config.service_call_fields])
    if (len(sc_second_model) > 0):
        if (len(sc_second_model) > 100):
            data_first_retrain = self.aggregate_data_for_historic_averages_model(agg_minutes=agg_minutes, end_time=max_request_timestamp, ids_to_exclude=ids_to_exclude)
            if (len(data_first_retrain) > 0):
                data_first_retrain = data_first_retrain.merge(sc_second_model[self._config.service_call_fields])
        else:
            data_first_retrain = self.aggregate_data_for_historic_averages_model(agg_minutes=agg_minutes, service_calls=sc_second_model[self._config.service_call_fields], end_time=max_request_timestamp, ids_to_exclude=ids_to_exclude)
    if (len(sc_regular) > 0):
        data_regular = self.aggregate_data_for_historic_averages_model(agg_minutes=agg_minutes, start_time=last_fit_timestamp, end_time=max_request_timestamp, ids_to_exclude=ids_to_exclude)
        if (len(data_regular) > 0):
            data_regular = data_regular.merge(sc_regular[self._config.service_call_fields])
    return (data_regular, data_first_train, data_first_retrain)
def get_data_for_train_stages(self, sc_regular, sc_first_model, sc_second_model, relevant_anomalous_metrics, max_incident_creation_timestamp, last_fit_timestamp, agg_minutes, max_request_timestamp):
    ids_to_exclude = self.get_request_ids_from_incidents(incident_status=['incident'], relevant_anomalous_metrics=relevant_anomalous_metrics, max_incident_creation_timestamp=max_incident_creation_timestamp)
    if (max_request_timestamp is not None):
        max_request_timestamp = (max_request_timestamp.timestamp() * 1000)
    if (last_fit_timestamp is not None):
        last_fit_timestamp = (last_fit_timestamp.timestamp() * 1000)
    data_regular = pd.DataFrame()
    data_first_train = pd.DataFrame()
    data_first_retrain = pd.DataFrame()
    if (len(sc_first_model) > 0):
        if (len(sc_first_model) > 100):
            data_first_train = self.aggregate_data_for_historic_averages_model(agg_minutes=agg_minutes, end_time=max_request_timestamp)
            if (len(data_first_train) > 0):
                data_first_train = data_first_train.merge(sc_first_model[self._config.service_call_fields])
        else:
            data_first_train = self.aggregate_data_for_historic_averages_model(agg_minutes=agg_minutes, end_time=max_request_timestamp, service_calls=sc_first_model[self._config.service_call_fields])
    if (len(sc_second_model) > 0):
        if (len(sc_second_model) > 100):
            data_first_retrain = self.aggregate_data_for_historic_averages_model(agg_minutes=agg_minutes, end_time=max_request_timestamp, ids_to_exclude=ids_to_exclude)
            if (len(data_first_retrain) > 0):
                data_first_retrain = data_first_retrain.merge(sc_second_model[self._config.service_call_fields])
        else:
            data_first_retrain = self.aggregate_data_for_historic_averages_model(agg_minutes=agg_minutes, service_calls=sc_second_model[self._config.service_call_fields], end_time=max_request_timestamp, ids_to_exclude=ids_to_exclude)
    if (len(sc_regular) > 0):
        data_regular = self.aggregate_data_for_historic_averages_model(agg_minutes=agg_minutes, start_time=last_fit_timestamp, end_time=max_request_timestamp, ids_to_exclude=ids_to_exclude)
        if (len(data_regular) > 0):
            data_regular = data_regular.merge(sc_regular[self._config.service_call_fields])
    return (data_regular, data_first_train, data_first_retrain)