def load_secrets(args): """ Load secret from remote Taskcluster Instance """ assert args.taskcluster_secret, "Missing taskcluster secret" tc = TaskclusterConfig("https://firefox-ci-tc.services.mozilla.com") tc.auth() return tc.load_secrets(args.taskcluster_secret)
def mock_taskcluster(): """ Mock Tasklcuster authentication """ tc = TaskclusterConfig("http://taskcluster.test") # Force options to avoid auto proxy detection tc.auth("client", "token") tc.default_url = "http://taskcluster.test" tc.options["maxRetries"] = 1 return tc
def _is_queue_overloaded(provisioner_id: str, worker_type: str, acceptable_limit=100) -> bool: """ Helper method for PerfSheriffBot to check load on processing queue. Usage example: _queue_is_too_loaded('gecko-3', 'b-linux') :return: True/False """ tc = TaskclusterConfig('https://firefox-ci-tc.services.mozilla.com') tc.auth(client_id=CLIENT_ID, access_token=ACCESS_TOKEN) queue = tc.get_service('queue') pending_tasks_count = queue.pendingTasks(provisioner_id, worker_type).get('pendingTasks') return pending_tasks_count > acceptable_limit