Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
RenderToolbox4
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chenhao Ma
RenderToolbox4
Commits
e2376568
Commit
e2376568
authored
7 years ago
by
Henryk Krzysztof Blasinski
Browse files
Options
Downloads
Patches
Plain Diff
Added cloud renderer initialization.
parent
dcfd9a07
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
BatchRenderer/Renderers/PBRT/RtbPBRTCloudRenderer.m
+11
-0
11 additions, 0 deletions
BatchRenderer/Renderers/PBRT/RtbPBRTCloudRenderer.m
Utilities/rtbCloudInit.m
+75
-0
75 additions, 0 deletions
Utilities/rtbCloudInit.m
Utilities/rtbCloudUpload.m
+1
-1
1 addition, 1 deletion
Utilities/rtbCloudUpload.m
with
87 additions
and
1 deletion
BatchRenderer/Renderers/PBRT/RtbPBRTCloudRenderer.m
+
11
−
0
View file @
e2376568
...
...
@@ -24,6 +24,17 @@ classdef RtbPBRTCloudRenderer < RtbRenderer
% where to put scenes before rendering
workingFolder
;
% Variables specific to cloud provider
provider
=
'Google'
;
clusterName
=
'rtb4'
;
zone
=
'us-central1-a'
;
instanceType
=
'n1-highcpu-32'
;
minInstances
=
1
;
maxInstances
=
10
;
preemptible
=
true
;
autoscaling
=
true
;
end
methods
...
...
This diff is collapsed.
Click to expand it.
Utilities/rtbCloudInit.m
0 → 100644
+
75
−
0
View file @
e2376568
function
rtbCloudInit
(
hints
)
% This function sets up the Container engine on google cloud.
% We assume that you have goocle cloud SDK installed on your system and
% that you have set up the sdk by running:
%
% gcloud init
%
%
if
strcmp
(
hints
.
renderer
,
'PBRTCloud'
)
==
0
return
;
end
if
~
strcmpi
(
hints
.
batchRenderStrategy
.
renderer
.
provider
,
'google'
)
error
(
'Only Google Cloud is supported\n'
);
end
% First we set up a container cluster
% This command sets up a cluster of high-cpu, 32 core, preemptible machines
% Autoscaling is enabled so if you aren't using all the resources the
% unnecessary machines are killed (to save you money).
clusterName
=
hints
.
batchRenderStrategy
.
renderer
.
clusterName
;
timeZone
=
hints
.
batchRenderStrategy
.
renderer
.
zone
;
cmd
=
sprintf
(
'gcloud container clusters list --filter=%s'
,
clusterName
);
[
~
,
result
]
=
system
(
cmd
);
if
isempty
(
result
)
% we need to create a new cluster
instanceType
=
hints
.
batchRenderStrategy
.
renderer
.
instanceyType
;
cmd
=
sprintf
(
'gcloud container clusters create %s --num-nodes=1 --max-nodes-per-pool=100 --machine-type=%s --zone=%s'
,
...
clusterName
,
instanceType
,
timeZone
);
if
hints
.
batchRenderStrategy
.
renderer
.
preemptible
,
cmd
=
sprintf
(
'%s --preemptible'
,
cmd
);
end
minNodes
=
hints
.
batchRenderStrategy
.
renderer
.
minNodes
;
maxNodes
=
hints
.
batchRenderStrategy
.
renderer
.
maxNodes
;
if
hints
.
batchRenderStrategy
.
renderer
.
autoscaling
,
cmd
=
sprintf
(
'%s --enable-autoscaling --min-nodes=%i --max-nodes==%i'
,
...
cmd
,
minNodes
,
maxNodes
);
end
system
(
cmd
)
end
% Once the container cluster is created one neds to get credentials, so
% that kubectl comands are executed on that particualr cluster.
cmd
=
sprintf
(
'gcloud container clusters get-credentials %s --zone=%s'
,
...
clusterName
,
timeZone
);
system
(
cmd
);
% A cleanup-job
% The Container Cluster stores the completed jobs, and they use up
% resources (disk space, memory). We are going to run a simple service that
% periodically lists all succesfully completed jobs and removes them from
% the engine.
cmd
=
'kubectl get jobs | grep cleanup'
;
[
~
,
result
]
=
system
(
cmd
);
if
isempty
(
result
)
cmd
=
'kubectl run cleanup --restart=OnFailure --image=google/cloud-sdk -- /bin/bash -c
''
while true; do echo "Starting"; kubectl delete jobs $(kubectl get jobs | awk
''
"
''
"
''
$3=="1" {print $1}
''
"
''
"
''
); echo "Deleted jobs"; sleep 600; done
''
'
;
system
(
cmd
);
end
end
This diff is collapsed.
Click to expand it.
Utilities/rtbCloudUpload.m
+
1
−
1
View file @
e2376568
...
...
@@ -17,7 +17,7 @@ allFilesAndFolders = sprintf('%s ./resources ./scenes',allFiles);
currentPath
=
pwd
;
cd
(
hints
.
batchRenderStrategy
.
renderer
.
workingFolder
);
cmd
=
sprintf
(
'zip -r %s/%s %s'
,
hints
.
batchRenderStrategy
.
renderer
.
workingFolder
,
fileName
,
allFilesAndFolders
);
cmd
=
sprintf
(
'zip -r %s/%s %s
-x *.jpg *.png
'
,
hints
.
batchRenderStrategy
.
renderer
.
workingFolder
,
fileName
,
allFilesAndFolders
);
system
(
cmd
);
cd
(
currentPath
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment