obey custom timeout supplied by cocoon (#9260)
diff --git a/dev/devicelab/lib/framework/framework.dart b/dev/devicelab/lib/framework/framework.dart index b495eb6..1d0cff0 100644 --- a/dev/devicelab/lib/framework/framework.dart +++ b/dev/devicelab/lib/framework/framework.dart
@@ -16,7 +16,7 @@ /// Maximum amount of time a single task is allowed to take to run. /// /// If exceeded the task is considered to have failed. -const Duration taskTimeout = const Duration(minutes: 25); +const Duration _kDefaultTaskTimeout = const Duration(minutes: 15); /// Represents a unit of work performed in the CI environment that can /// succeed, fail and be retried independently of others. @@ -63,7 +63,10 @@ _TaskRunner(this.task) { registerExtension('ext.cocoonRunTask', (String method, Map<String, String> parameters) async { - final TaskResult result = await run(); + final Duration taskTimeout = parameters.containsKey('timeoutInMinutes') + ? new Duration(minutes: int.parse(parameters['timeoutInMinutes'])) + : _kDefaultTaskTimeout; + final TaskResult result = await run(taskTimeout); return new ServiceExtensionResponse.result(JSON.encode(result.toJson())); }); registerExtension('ext.cocoonRunnerReady', @@ -75,7 +78,7 @@ /// Signals that this task runner finished running the task. Future<TaskResult> get whenDone => _completer.future; - Future<TaskResult> run() async { + Future<TaskResult> run(Duration taskTimeout) async { try { _taskStarted = true; final TaskResult result = await _performTask().timeout(taskTimeout);
diff --git a/dev/devicelab/manifest.yaml b/dev/devicelab/manifest.yaml index 2a8960a..91c73f2 100644 --- a/dev/devicelab/manifest.yaml +++ b/dev/devicelab/manifest.yaml
@@ -143,6 +143,7 @@ Runs benchmarks from dev/benchmarks/microbenchmarks. stage: devicelab required_agent_capabilities: ["has-android-device"] + timeout_in_minutes: 30 flutter_view__start_up: description: > @@ -195,6 +196,7 @@ Runs benchmarks from dev/benchmarks/microbenchmarks on iOS. stage: devicelab_ios required_agent_capabilities: ["has-ios-device"] + timeout_in_minutes: 30 flutter_view_ios__start_up: description: >