in bot/code_coverage_bot/hooks/base.py [0:0]
def index_task(self, namespaces, ttl=180):
"""
Index current task on Taskcluster Index
TTL is expressed in days
"""
assert isinstance(ttl, int) and ttl > 0
task_id = os.environ.get("TASK_ID")
if task_id is None:
logger.warning("Skipping Taskcluster indexation, no task id found.")
return
index_service = taskcluster_config.get_service("index")
for namespace in namespaces:
index_service.insertTask(
namespace,
{
"taskId": task_id,
"rank": 0,
"data": {},
"expires": (datetime.utcnow() + timedelta(ttl)).strftime(
"%Y-%m-%dT%H:%M:%S.%fZ"
),
},
)