Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escaping: Escape characters +-&|!(){}[]^"~*?:\ with \, e.g. \+
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
Hi

Hi 🙂
I'm working on slack alerts based on the open source example, we added slack mentions like this

    def get_username_tag(self, task:Task):
        res = Task._get_default_session().send_request("users", "get_all")
        if not res.ok:
            raise RuntimeError("Cannot get list of all users!")
        all_users = {d["name"]: d["id"] for d in res.json()["data"]["users"]}

        task_user_id = task.data.user
        
        for user_name, user_id in all_users.items():
            if user_id == task_user_id:
                fixed_user_name = user_name.lower().replace(" ", ".")
                return f"<@{fixed_user_name}>"

        return f"Unknown User ({user_id})"

This works great for normal tasks, but for pipelines the inner steps return the agent's id.

I'm trying to get the parent task's creator, but it returns a user id that doesn't exist in the all_users list 🤔 . Any idea how to achieve this?

  
  
Posted 3 months ago
Votes Newest

Answers 4


Hi @<1523701949617147904:profile|PricklyRaven28> , note that steps in a pipeline are special tasks with hidden system tag, I think you might want to enable that in your search

  
  
Posted 3 months ago

what i'm doing is getting

parent = Task.get_task(task.parent)

and then checking
parent.data.user

but the user is some unknown id that doesn't exist in the all_users list

  
  
Posted 3 months ago

What about fetching the parent from the task info itself? It should be somewhere in task.data.

  
  
Posted 3 months ago

The task is given by the monitor(like in the example) the problem is the user

  
  
Posted 3 months ago
139 Views
4 Answers
3 months ago
3 months ago
Tags