Skip to content

Commit cd41ef3

Browse files
0x2b3bfa0casperdcl
andauthored
Add user-oriented file transfer logs (#463)
Co-authored-by: Casper da Costa-Luis <casper.dcl@physics.org>
1 parent 64c8280 commit cd41ef3

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

docs/guides/getting-started.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ This command will:
8585

8686
With spot/preemptible instances (`spot >= 0`), auto-recovery logic and persistent storage will be used to relaunch interrupted tasks.
8787

88+
-> **Note:** A large `workdir` may take a long time to upload.
89+
8890
## Query Status
8991

9092
```console
@@ -108,3 +110,5 @@ This command will:
108110
2. Delete all the cloud resources created by `terraform apply`.
109111

110112
In this example, after running `terraform destroy`, the `results` directory should contain a file named `greeting.txt` with the text `Hello, World!`
113+
114+
-> **Note:** A large `output` directory may take a long time to download.

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ require (
2121
github.com/blang/semver/v4 v4.0.0
2222
github.com/brianvoe/gofakeit/v6 v6.9.0
2323
github.com/cloudflare/gokey v0.1.0
24+
github.com/docker/go-units v0.4.0 // indirect
2425
github.com/gobwas/glob v0.2.3
2526
github.com/google/go-github/v42 v42.0.0
2627
github.com/hashicorp/hcl/v2 v2.8.0 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQ
295295
github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U=
296296
github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE=
297297
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
298+
github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=
299+
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
298300
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
299301
github.com/dop251/scsu v0.0.0-20200422003335-8fadfb689669/go.mod h1:Gth7Xev0h28tuTayG4HlTZy90IXhiDgV2+MLtJzjpP0=
300302
github.com/dropbox/dropbox-sdk-go-unofficial/v6 v6.0.3 h1:h71/Ky9+298V45NSkxjhFv0aGsFOtPvqr25vbr5yMB0=

task/common/machine/storage.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99
"path/filepath"
1010
"strings"
1111

12+
units "github.com/docker/go-units"
13+
1214
_ "github.com/rclone/rclone/backend/azureblob"
1315
_ "github.com/rclone/rclone/backend/googlecloudstorage"
1416
_ "github.com/rclone/rclone/backend/local"
@@ -19,6 +21,8 @@ import (
1921
"github.com/rclone/rclone/fs/operations"
2022
"github.com/rclone/rclone/fs/sync"
2123

24+
"github.com/sirupsen/logrus"
25+
2226
"terraform-provider-iterative/task/common"
2327
)
2428

@@ -120,6 +124,12 @@ func Transfer(ctx context.Context, source, destination string, include string) e
120124
return err
121125
}
122126

127+
if count, size, err := operations.Count(ctx, sourceFileSystem); err == nil {
128+
logrus.Infof("Transferring %s (%d files)...", units.HumanSize(float64(size)), count)
129+
} else {
130+
return err
131+
}
132+
123133
return sync.CopyDir(ctx, destinationFileSystem, sourceFileSystem, true)
124134
}
125135

0 commit comments

Comments
 (0)