Skip to content

Monitor tag propagation

Atlan's background tasks queue provides essential insights for monitoring tag propagation of assets, detailing completed, pending, in-progress, and deleted tasks. In Atlan's SDK you can use the FluentTasks object to search the tasks queue.

2.0.2 1.10.10

For example, to initiate a search for pending tag propagation tasks related to a specific asset after a tag has been added:

Search for background tag propagation tasks
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
AtlanClient client = Atlan.getDefaultClient(); // (1)

client.tasks.select() // (2)
    // (3)
    .where(AtlanTask.ENTITY_GUID.eq("f65e3da2-6ec2-4ff5-8f0b-b6eba640df24"))
    .where(AtlanTask.TYPE.eq(AtlanTaskType.CLASSIFICATION_PROPAGATION_ADD))
    .where(AtlanTask.STATUS.match(AtlanTaskStatus.PENDING.getValue()))
    .stream() // (4)
    .forEach(task -> { // (5)
        log.info("Task: {}", task);
    });
  1. Start with a client to run the tasks search through. For the default client, you can always use Atlan.getDefaultClient().
  2. To search across all tasks, you can use the tasks.select() convenience method on a client.
  3. The .where() method allows you to limit to only tasks that have a particular value in a particular field:

    • GUID of the asset for which you want to retrieve tag propagation tasks.
    • Specify the task type; in this example, we're retrieving tasks for monitoring propagation after a tag has been added to the asset.
    • Specify the task status; here, we're checking for any pending tag propagation tasks for the given asset.

    Note: There's no need to try to remember or even know the precise string values for the above constants. Enums for these values are available in the SDK, making it easier for you.

  4. The search will only run when you call the stream() method, which will then lazily-load each page of results into a stream.

  5. This is the pattern for iterating through all results (across pages) covered in the Searching for assets portion of the SDK documentation.
Search for background tag propagation tasks
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.task import AtlanTask
from pyatlan.model.fluent_tasks import FluentTasks
from pyatlan.model.enums import AtlanTaskStatus, AtlanTaskType

client = AtlanClient()

task_request = (
    FluentTasks() # (1)
    .where( # (2)
        AtlanTask.ENTITY_GUID.eq("f65e3da2-6ec2-4ff5-8f0b-b6eba640df24")
    )
    .where(
        AtlanTask.TYPE.eq(AtlanTaskType.CLASSIFICATION_PROPAGATION_ADD.value)
    )
    .where(
        AtlanTask.STATUS.match(AtlanTaskStatus.PENDING.value)
    )
    .to_request() # (3)
)

response = client.tasks.search(request=task_request) # (4)

for task in response:  # (5)
    ...
  1. You can use FluentTasks() to simplify the most common searches against the Atlan task queue.
  2. The .where() method allows you to limit to only tasks that have a particular value in a particular field:

    • GUID of the asset for which you want to retrieve tag propagation tasks.
    • Specify the task type; in this example, we're retrieving tasks for monitoring propagation after a tag has been added to the asset.
    • Specify the task status; here, we're checking for any pending tag propagation tasks for the given asset.

    Note: There's no need to try to remember or even know the precise string values for the above constants. Enums for these values are available in the SDK, making it easier for you.

  3. Build the task request object using the provided search criteria.

  4. Initiate the task request search by providing the created request object.
  5. This is the pattern for iterating through all results (across pages) covered in the Searching for assets portion of the SDK documentation.
Search for background tag propagation tasks
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
val client = Atlan.getDefaultClient() // (1)

client.assets.select() // (2)
     // (3)
    .where(AtlanTask.ENTITY_GUID.eq("f65e3da2-6ec2-4ff5-8f0b-b6eba640df24"))
    .where(AtlanTask.TYPE.eq(AtlanTaskType.CLASSIFICATION_PROPAGATION_ADD))
    .where(AtlanTask.STATUS.match(AtlanTaskStatus.PENDING.value))
    .stream() // (4)
    .forEach { // (5)
        log.info { "Task: $it" }
    }
  1. Start with a client to run the tasks search through. For the default client, you can always use Atlan.getDefaultClient().
  2. To search across all tasks, you can use the tasks.select() convenience method on a client.
  3. The .where() method allows you to limit to only tasks that have a particular value in a particular field:

    • GUID of the asset for which you want to retrieve tag propagation tasks.
    • Specify the task type; in this example, we're retrieving tasks for monitoring propagation after a tag has been added to the asset.
    • Specify the task status; here, we're checking for any pending tag propagation tasks for the given asset.

    Note: There's no need to try to remember or even know the precise string values for the above constants. Enums for these values are available in the SDK, making it easier for you.

  4. The search will only run when you call the stream() method, which will then lazily-load each page of results into a stream.

  5. This is the pattern for iterating through all results (across pages) covered in the Searching for assets portion of the SDK documentation.
POST /api/meta/task/search
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{
 "dsl": {
   "from": 0,
   "size": 20,
   "query": {
     "bool": {
       "filter": [
         {
           "term": {
             "__task_entityGuid": {
               "value": "f65e3da2-6ec2-4ff5-8f0b-b6eba640df24", // (1)
               "case_insensitive": false
             }
           }
         },
         {
           "term": {
             "__task_type": {
               "value": "CLASSIFICATION_PROPAGATION_ADD" // (2)
             }
           }
         },
         {
           "match": {
             "__task_status": {
               "query": "PENDING" // (3)
             }
           }
         }
       ]
     }
   },
   "sort": [
     {
       "__task_startTime": {
         "order": "asc" // (4)
       }
     }
   ],
   "track_total_hits": true
 }
}
  1. GUID of the asset for which you want to retrieve tag propagation tasks.
  2. Specify the task type; in this example, we're retrieving tasks for monitoring propagation after a tag has been added to the asset.
  3. Specify the task status; here, we're checking for any pending tag propagation tasks for the given asset.
  4. This is the default sort order for tag propagation tasks search.