8000 Add a timeout attribute to pip_import rules. · bazel-contrib/rules_python@6915c78 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6915c78

Browse files
ChrisCumminsbrandjon
authored andcommitted
Add a timeout attribute to pip_import rules.
The combination of a large requirements.txt file and a slow network can cause the default timeout for repository_ctx.execute() to be reached. This patch exposes that timeout to the pip_import() caller so they can manually specify a longer timeout. E.g. 8000 pip_import( name = "requirements", requirements = "//long_list_of_requirements.txt", timeout = 3600, )
1 parent abc4869 commit 6915c78

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

python/pip.bzl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def _pip_import_impl(repository_ctx):
4343
]
4444

4545
# To see the output, pass: quiet=False
46-
result = repository_ctx.execute(args)
46+
result = repository_ctx.execute(args, timeout=repository_ctx.attr.timeout)
4747

4848
if result.return_code:
4949
fail("pip_import failed: %s (%s)" % (result.stdout, result.stderr))
@@ -62,6 +62,10 @@ wheels.
6262
allow_single_file = True,
6363
doc = "The label of the requirements.txt file.",
6464
),
65+
"timeout": attr.int(
66+
default = 600,
67+
doc = "Timeout (in seconds) for repository fetch."
68+
),
6569
"_script": attr.label(
6670
executable = True,
6771
default = Label("//tools:piptool.par"),

0 commit comments

Comments
 (0)
0