Skip to content

Commit

Permalink
improve filter semantics
Browse files Browse the repository at this point in the history
  • Loading branch information
andre-merzky committed Oct 2, 2023
1 parent 430bb2d commit 03b3532
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/radical/analytics/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,32 +485,32 @@ 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)
uids = ru.as_list(uid)
state = ru.as_list(state)
event = ru.as_list(event)
time = ru.as_list(time )


if isinstance(uid, re.Pattern):
# uid is actually a regex we use for matching
uid_regex = True
else:
# uid is a list of strings to look out for
uid_regex = False
uid = ru.as_list(uid)


ret = list()
for eid,entity in list(self._entities.items()):

if etype and entity.etype not in etype: continue

if uid:
if uid_regex:
if not uid.match(entity.uid):
continue
else:
if 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 03b3532

Please sign in to comment.