stage: Add argument to move files locally instead of copying.
In some use cases of staging files from a local path, we begin by
preparing the files to stage in a tempdir, we then stage these files via
the RPC and immediately delete the source file.
This CL adds an argument to the stage RPC to be used when staging local
files that directs us to simply move the files instead of copying.
This is especially useful when the devserver is running in a VM (moblab
VM) where the staging time goes down from ~30 minutes to 3 minutes after
this change.
BUG=chromium:799724
TEST=Run 'cros stage' on a moblab vm.
Change-Id: Ie1206ae9ccb25802cc241b25e3a611e46893b16c
Reviewed-on: https://chromium-review.googlesource.com/877387
Commit-Ready: Prathmesh Prabhu <[email protected]>
Tested-by: Prathmesh Prabhu <[email protected]>
Tested-by: Congbin Guo <[email protected]>
Reviewed-by: Prathmesh Prabhu <[email protected]>
Reviewed-by: Xixuan Wu <[email protected]>
diff --git a/devserver.py b/devserver.py
index 81cce8e..71f14b1 100755
--- a/devserver.py
+++ b/devserver.py
@@ -270,7 +270,9 @@
dl = None
if local_path:
- dl = downloader.LocalDownloader(updater.static_dir, local_path)
+ delete_source = _parse_boolean_arg(kwargs, 'delete_source')
+ dl = downloader.LocalDownloader(updater.static_dir, local_path,
+ delete_source=delete_source)
if not _is_android_build_request(kwargs):
archive_url = kwargs.get('archive_url')
@@ -839,6 +841,10 @@
Args:
archive_url: Google Storage URL for the build.
local_path: Local path for the build.
+ delete_source: Only meaningful with local_path. bool to indicate if the
+ source files should be deleted. This is especially useful when staging
+ a file locally in resource constrained environments as it allows us to
+ move the relevant files locally instead of copying them.
async: True to return without waiting for download to complete.
artifacts: Comma separated list of named artifacts to download.
These are defined in artifact_info and have their implementation