diff --git a/dev/devicelab/lib/framework/framework.dart b/dev/devicelab/lib/framework/framework.dart index b495eb69d6..1d0cff0dc3 100644 --- a/dev/devicelab/lib/framework/framework.dart +++ b/dev/devicelab/lib/framework/framework.dart @@ -16,7 +16,7 @@ import 'utils.dart'; /// 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 @@ class _TaskRunner { _TaskRunner(this.task) { registerExtension('ext.cocoonRunTask', (String method, Map 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 @@ class _TaskRunner { /// Signals that this task runner finished running the task. Future get whenDone => _completer.future; - Future run() async { + Future 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 2a8960aab9..91c73f281f 100644 --- a/dev/devicelab/manifest.yaml +++ b/dev/devicelab/manifest.yaml @@ -143,6 +143,7 @@ tasks: 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 @@ tasks: 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: >