Feature: support for shared downloads directory (#295)
* Feature: support for shared downloads directory This feature is especially relevant for users with several clients running simultaneously within the same computer (computers running several GPUs or any combination of GPUs + CPUs) or multiple computers running in a network. The feature allows the user to specify a shared downloads directory via the new -shared-downloads-dir client option. All the clients using that option will share the same binaries and scene files. How it works? The first client downloading a binary or scene will save the file in the directory especified in -shared-downloads-directory. The rest of the clients using the same option will wait until the file has been downloaded. Once the file has been downloaded, it will be ready for the rest of the clients. This feature is especially relevant for users with metered/slow connections or multiple computers/clients that don't want to download the same binary/file multiple times. IMPORTANT: All the clients intended to share the binaries and scenes must execute the client with the same -shared-downloads-dir parameter.
This commit is contained in:
@@ -61,6 +61,8 @@ public class Worker {
|
||||
|
||||
@Option(name = "-cache-dir", usage = "Cache/Working directory. Caution, everything in it not related to the render-farm will be removed", metaVar = "/tmp/cache", required = false) private String cache_dir = null;
|
||||
|
||||
@Option(name = "-shared-zip", usage = "Shared directory for downloaded binaries and scenes. Useful when running two or more clients in the same computer/network to download once and render many times. IMPORTANT: This option and value must be identical in ALL clients sharing the directory.", required = false) private String sharedDownloadsDir = null;
|
||||
|
||||
@Option(name = "-gpu", usage = "Name of the GPU used for the render, for example CUDA_0 for Nvidia or OPENCL_0 for AMD/Intel card", metaVar = "CUDA_0", required = false) private String gpu_device = null;
|
||||
|
||||
@Option(name = "--no-gpu", usage = "Don't detect GPUs", required = false) private boolean no_gpu_detection = false;
|
||||
@@ -130,6 +132,15 @@ public class Worker {
|
||||
config.setUsePriority(priority);
|
||||
config.setDetectGPUs(!no_gpu_detection);
|
||||
|
||||
if (sharedDownloadsDir != null) {
|
||||
File dir = new File(sharedDownloadsDir);
|
||||
if (dir.exists() == false || dir.canWrite() == false) {
|
||||
System.err.println("ERROR: The shared-zip directory must exist and be writeable");
|
||||
return;
|
||||
}
|
||||
config.setSharedDownloadsDirectory(dir);
|
||||
}
|
||||
|
||||
if (cache_dir != null) {
|
||||
File a_dir = new File(cache_dir);
|
||||
a_dir.mkdirs();
|
||||
|
||||
Reference in New Issue
Block a user