@@ -52,12 +52,14 @@ public class S3DownloadStep extends AbstractS3Step {
52
52
private final String bucket ;
53
53
private String path = "" ;
54
54
private boolean force = false ;
55
+ private boolean disableParallelDownloads = false ;
55
56
56
57
@ DataBoundConstructor
57
- public S3DownloadStep (String file , String bucket , boolean pathStyleAccessEnabled , boolean payloadSigningEnabled ) {
58
+ public S3DownloadStep (String file , String bucket , boolean pathStyleAccessEnabled , boolean payloadSigningEnabled , boolean disableParallelDownloads ) {
58
59
super (pathStyleAccessEnabled , payloadSigningEnabled );
59
60
this .file = file ;
60
61
this .bucket = bucket ;
62
+ this .disableParallelDownloads = disableParallelDownloads ;
61
63
}
62
64
63
65
public String getFile () {
@@ -76,6 +78,10 @@ public boolean isForce() {
76
78
return this .force ;
77
79
}
78
80
81
+ public boolean isDisableParallelDownloads () {
82
+ return this .disableParallelDownloads ;
83
+ }
84
+
79
85
@ DataBoundSetter
80
86
public void setForce (boolean force ) {
81
87
this .force = force ;
@@ -86,6 +92,11 @@ public void setPath(String path) {
86
92
this .path = path ;
87
93
}
88
94
95
+ @ DataBoundSetter
96
+ public void setDisableParallelDownload (boolean disableParallelDownloads ) {
97
+ this .disableParallelDownloads = disableParallelDownloads ;
98
+ }
99
+
89
100
@ Override
90
101
public StepExecution start (StepContext context ) throws Exception {
91
102
return new S3DownloadStep .Execution (this , context );
@@ -130,6 +141,7 @@ public Void run() throws Exception {
130
141
final String bucket = this .step .getBucket ();
131
142
final String path = this .step .getPath ();
132
143
final boolean force = this .step .isForce ();
144
+ final boolean disableParallelDownloads = this .step .isDisableParallelDownloads ();
133
145
134
146
Preconditions .checkArgument (bucket != null && !bucket .isEmpty (), "Bucket must not be null or empty" );
135
147
@@ -146,7 +158,7 @@ public Void run() throws Exception {
146
158
throw new RuntimeException ("Target exists: " + target .toURI ().toString ());
147
159
}
148
160
}
149
- target .act (new RemoteDownloader (Execution .this .step .createS3ClientOptions (), envVars , listener , bucket , path ));
161
+ target .act (new RemoteDownloader (Execution .this .step .createS3ClientOptions (), envVars , listener , bucket , path , disableParallelDownloads ));
150
162
listener .getLogger ().println ("Download complete" );
151
163
return null ;
152
164
}
@@ -162,19 +174,22 @@ private static class RemoteDownloader extends MasterToSlaveFileCallable<Void> {
162
174
private final TaskListener taskListener ;
163
175
private final String bucket ;
164
176
private final String path ;
177
+ private final Boolean disableParallelDownloads ;
165
178
166
- RemoteDownloader (S3ClientOptions amazonS3ClientOptions , EnvVars envVars , TaskListener taskListener , String bucket , String path ) {
179
+ RemoteDownloader (S3ClientOptions amazonS3ClientOptions , EnvVars envVars , TaskListener taskListener , String bucket , String path , Boolean disableParallelDownloads ) {
167
180
this .amazonS3ClientOptions = amazonS3ClientOptions ;
168
181
this .envVars = envVars ;
169
182
this .taskListener = taskListener ;
170
183
this .bucket = bucket ;
171
184
this .path = path ;
185
+ this .disableParallelDownloads = disableParallelDownloads ;
172
186
}
173
187
174
188
@ Override
175
189
public Void invoke (File localFile , VirtualChannel channel ) throws IOException , InterruptedException {
176
190
TransferManager mgr = TransferManagerBuilder .standard ()
177
191
.withS3Client (AWSClientFactory .create (this .amazonS3ClientOptions .createAmazonS3ClientBuilder (), this .envVars ))
192
+ .withDisableParallelDownloads (this .disableParallelDownloads )
178
193
.build ();
179
194
180
195
if (this .path == null || this .path .isEmpty () || this .path .endsWith ("/" )) {
0 commit comments