Skip to content

Commit

Permalink
Merge pull request #179 from radical-cybertools/feature/uid_filter
Browse files Browse the repository at this point in the history
Feature/uid filter
  • Loading branch information
andre-merzky authored Oct 31, 2023
2 parents 0931de1 + d994675 commit 67305b4
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/radical/analytics/session.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# pylint: disable=W0102,W0212

import re
import os
import sys
import copy
Expand Down Expand Up @@ -484,7 +485,7 @@ def _apply_filter(self, etype=None, uid=None, state=None,
# which match the given set of filters (after removing all events which
# are not in the given time ranges)
etype = ru.as_list(etype)
uid = ru.as_list(uid )
uids = ru.as_list(uid)
state = ru.as_list(state)
event = ru.as_list(event)
time = ru.as_list(time )
Expand All @@ -493,7 +494,23 @@ def _apply_filter(self, etype=None, uid=None, state=None,
for eid,entity in list(self._entities.items()):

if etype and entity.etype not in etype: continue
if uid and entity.uid not in uid : continue

if uids:
keep = False
for uid in uids:
if isinstance(uid, re.Pattern):
# uid is actually a regex we use for matching
if uid.match(entity.uid):
keep = True
break
else:
# uid is a specific string to look out for
if entity.uid == uid:
keep = True
break

if not keep:
continue

if state:
match = False
Expand Down

0 comments on commit 67305b4

Please sign in to comment.