Ejemplo n.º 1
0
    def ReadHuntFlowsStatesAndTimestamps(self, hunt_id):
        """Reads hunt flows states and timestamps."""

        result = []
        for f in self._GetHuntFlows(hunt_id):
            result.append(
                db.FlowStateAndTimestamps(flow_state=f.flow_state,
                                          create_time=f.create_time,
                                          last_update_time=f.last_update_time))

        return result
Ejemplo n.º 2
0
    def ReadHuntFlowsStatesAndTimestamps(self, hunt_id, cursor=None):
        """Reads hunt flows states and timestamps."""

        query = """
      SELECT
        flow_state, UNIX_TIMESTAMP(timestamp), UNIX_TIMESTAMP(last_update)
      FROM flows
      FORCE INDEX(flows_by_hunt)
      WHERE parent_hunt_id = %s AND parent_flow_id IS NULL
    """

        cursor.execute(query, [db_utils.HuntIDToInt(hunt_id)])

        result = []
        for fs, ct, lup in cursor.fetchall():
            result.append(
                db.FlowStateAndTimestamps(
                    flow_state=rdf_flow_objects.Flow.FlowState.FromInt(fs),
                    create_time=mysql_utils.TimestampToRDFDatetime(ct),
                    last_update_time=mysql_utils.TimestampToRDFDatetime(lup)))

        return result