+# Experimentation suggests Alibaba Cloud API calls are extremely
+# unreliable, with a failure rate around 1%. It is therefore
+# necessary to allow for retrying basically every API call.
+#
+# Some API calls (e.g. DescribeImages or ModifyImageAttribute) are
+# naturally idempotent and so safe to retry. Some non-idempotent API
+# calls (e.g. CopyImage) support explicit idempotence tokens. The
+# remaining API calls may simply fail on a retry, if the original
+# request happened to succeed but failed to return a response.
+#
+# We could write convoluted retry logic around the non-idempotent
+# calls, but this would substantially increase the complexity of the
+# already unnecessarily complex code. For now, we assume that
+# retrying non-idempotent requests is probably more likely to fix
+# transient failures than to cause additional problems.
+#
+RUNTIME_OPTS = util.models.RuntimeOptions(
+ autoretry=True,
+ max_attempts=5,
+ connect_timeout=10000,
+ read_timeout=120000,
+)
+