@@ -185,8 +185,8 @@ def cli(): # noqa: D301
185
185
$ mkdir -p ~/project/reana/src
186
186
$ cd ~/project/reana/src
187
187
$ # create new virtual environment
188
- $ virtualenv ~/.virtualenvs/myreana
189
- $ source ~/.virtualenvs/myreana /bin/activate
188
+ $ virtualenv ~/.virtualenvs/reana
189
+ $ source ~/.virtualenvs/reana /bin/activate
190
190
$ # install reana-dev developer helper script
191
191
$ pip install git+git://github.com/reanahub/reana.git#egg=reana
192
192
$ # run ssh-agent locally to simplify GitHub interaction
@@ -202,27 +202,31 @@ def cli(): # noqa: D301
202
202
$ eval "$(reana-dev git-fork -c ALL)"
203
203
$ reana-dev git-clone -c ALL -u tiborsimko
204
204
205
- How to install latest ``master`` REANA client CLI scripts :
205
+ How to run CI tests :
206
206
207
207
.. code-block:: console
208
208
209
209
\b
210
- $ reana-dev client-install
210
+ $ # example (a): fast, CLI mode only, fast example
211
+ $ reana-dev cluster-delete
212
+ $ reana-dev run-ci -m /var/reana:/var/reana -c r-d-helloworld --exclude-components=r-ui,r-a-vomsproxy
213
+ $ # example (b): slow, CLI and Web modes, all examples
214
+ $ reana-dev cluster-delete
215
+ $ reana-dev run-ci
211
216
212
- How to compile and deploy latest ``master`` REANA cluster:
217
+ How to create REANA cluster:
213
218
214
219
.. code-block:: console
215
220
216
221
\b
217
- $ # create cluster and set docker environment
222
+ $ # example (a): simple cluster creation
218
223
$ reana-dev cluster-create
219
- $ kubectl cluster-info --context kind-kind
220
- $ # option (a): cluster in production-like mode
221
- $ reana-dev docker-build
222
- $ helm install reana helm/reana
223
- $ # option (b): cluster in developer-like debug-friendly mode
224
- $ reana-dev docker-build -b DEBUG=1
225
- $ helm install reana helm/reana --set debug.enabled=true
224
+ $ # example (b): mount sharing /var/reana with host
225
+ $ reana-dev cluster-create -m /var/reana:/var/reana
226
+ $ # example (c): mount sharing /var/reana with host and /cvmfs for jobs
227
+ $ reana-dev cluster-create -m /var/reana:/var/reana -j /cvmfs:/cvmfs
228
+ $ # example (d): debug mode with code sharing as well
229
+ $ reana-dev cluster-create -m /var/reana:/var/reana --debug
226
230
227
231
How to set up your shell environment variables:
228
232
@@ -255,6 +259,7 @@ def cli(): # noqa: D301
255
259
$ cd reana-workflow-controller
256
260
$ reana-dev git-checkout -b . 72 --fetch
257
261
$ reana-dev docker-build -c .
262
+ $ reana-dev kind-load-docker-image -c .
258
263
$ reana-dev kubectl-delete-pod -c .
259
264
260
265
How to test multiple component branches:
@@ -266,7 +271,9 @@ def cli(): # noqa: D301
266
271
$ reana-dev git-checkout -b reana-workflow-controller 98
267
272
$ reana-dev git-status
268
273
$ reana-dev docker-build
274
+ $ reana-dev kind-load-docker-image -c reana-server
269
275
$ reana-dev kubectl-delete-pod -c reana-server
276
+ $ reana-dev kind-load-docker-image -c reana-workflow-controller
270
277
$ reana-dev kubectl-delete-pod -c reana-workflow-controller
271
278
272
279
How to test multiple component branches with commits to shared modules:
@@ -278,17 +285,7 @@ def cli(): # noqa: D301
278
285
$ reana-dev git-checkout -b reana-db 73
279
286
$ reana-dev git-checkout -b reana-workflow-controller 98
280
287
$ reana-dev git-checkout -b reana-server 112
281
- $ reana-dev git-submodule --update
282
- $ reana-dev client-install
283
- $ reana-dev install-cluster
284
- $ reana-dev docker-build
285
- $ helm delete helm/reana
286
- $ docker-exec -i -t kind-control-plane sh -c 'sudo rm -rf /var/reana/*'
287
- $ helm install reana helm/reana
288
- $ eval $(reana-dev client-setup-environment)
289
- $ reana-dev run-example -c r-d-helloworld
290
- $ reana-dev git-submodule --delete
291
- $ reana-dev git-status -s
288
+ $ reana-dev run-ci [using same old options]
292
289
293
290
How to release and push cluster component images:
294
291
@@ -757,6 +754,15 @@ def volume_mounts_to_list(ctx, param, value):
757
754
sys .exit (1 )
758
755
759
756
757
+ def is_cluster_created ():
758
+ """Return True/False based on whether there is a cluster created already."""
759
+ cmd = "kind get clusters"
760
+ output = run_command (cmd , "reana" , return_output = True )
761
+ if "kind" in output :
762
+ return True
763
+ return False
764
+
765
+
760
766
@cli .command ()
761
767
def version ():
762
768
"""Show version."""
@@ -1807,28 +1813,121 @@ def cluster_undeploy(): # noqa: D301
1807
1813
display_message (msg , "reana" )
1808
1814
1809
1815
1816
+ @click .option (
1817
+ "--build-arg" ,
1818
+ "-b" ,
1819
+ default = "" ,
1820
+ multiple = True ,
1821
+ help = "Any build arguments? (e.g. `-b COMPUTE_BACKENDS=kubernetes,htcondorcern,slurmcern`)" ,
1822
+ )
1810
1823
@click .option (
1811
1824
"-d" ,
1812
1825
"--debug" ,
1813
1826
is_flag = True ,
1814
1827
default = False ,
1815
1828
help = "Should we deploy REANA in debug mode? " ,
1816
1829
)
1830
+ @click .option (
1831
+ "--exclude-components" ,
1832
+ default = "" ,
1833
+ help = "Which components to exclude from build? [c1,c2,c3]" ,
1834
+ )
1835
+ @click .option (
1836
+ "-m" ,
1837
+ "--mount" ,
1838
+ "mounts" ,
1839
+ multiple = True ,
1840
+ help = "Which local directories to mount in the cluster nodes? [local_path:cluster_node_path]" ,
1841
+ )
1842
+ @click .option (
1843
+ "-j" ,
1844
+ "--job-mounts" ,
1845
+ multiple = True ,
1846
+ help = "Which directories from the Kubernetes nodes to mount inside the job pods? "
1847
+ "cluster_node_path:job_pod_mountpath, e.g /var/reana/mydata:/mydata" ,
1848
+ )
1849
+ @click .option ("--no-cache" , is_flag = True , help = "Do not use Docker image layer cache." )
1850
+ @click .option (
1851
+ "--component" ,
1852
+ "-c" ,
1853
+ multiple = True ,
1854
+ default = ["DEMO" ],
1855
+ help = "Which examples to run? [default=DEMO]" ,
1856
+ )
1817
1857
@cli .command (name = "run-ci" )
1818
- def run_ci (debug ): # noqa: D301
1858
+ def run_ci (
1859
+ build_arg , debug , exclude_components , mounts , job_mounts , no_cache , component ,
1860
+ ): # noqa: D301
1819
1861
"""Run CI build.
1820
1862
1821
1863
Builds and installs REANA and runs a demo example.
1864
+
1865
+ \b
1866
+ Basically it runs the following sequence of commands:
1867
+ $ reana-dev client-install
1868
+ $ reana-dev cluster-undeploy
1869
+ $ reana-dev cluster-build
1870
+ $ reana-dev cluster-deploy
1871
+ $ eval "$(reana-dev client-setup-environment)" && reana-dev run-example
1872
+
1873
+ in the appropriate order and with the appropriate mounting or debugging
1874
+ arguments.
1875
+
1876
+ \b
1877
+ Example:
1878
+ $ reana-dev run-cli -m /var/reana:/var/reana
1879
+ -m /usr/share/local/mydata:/mydata
1880
+ -j /mydata:/mydata
1881
+ -c r-d-helloworld
1882
+ --exclude-components=r-ui,r-a-vomsproxy
1883
+ --debug
1822
1884
"""
1885
+ # parse arguments
1886
+ components = select_components (component )
1887
+ # create cluster if needed
1888
+ if not is_cluster_created ():
1889
+ cmd = "reana-dev cluster-create"
1890
+ for mount in mounts :
1891
+ cmd += " -m {}" .format (mount )
1892
+ if debug :
1893
+ cmd += " --debug"
1894
+ run_command (cmd , "reana" )
1895
+ # prefetch and load images for selected demo examples
1896
+ for component in components :
1897
+ for cmd in [
1898
+ "reana-dev docker-pull -c {}" .format (component ),
1899
+ "reana-dev kind-load-docker-image -c {}" .format (component ),
1900
+ ]:
1901
+ run_command (cmd , "reana" )
1902
+ # undeploy cluster and install latest client
1823
1903
for cmd in [
1824
1904
"reana-dev cluster-undeploy" ,
1825
1905
"reana-dev client-install" ,
1826
- "reana-dev cluster-build" + (" --debug" if debug else "" ),
1827
- "reana-dev kind-load-docker-image -c CLUSTER --exclude-components=r-ui,r-a-vomsproxy" ,
1828
- "reana-dev cluster-deploy" + (" --debug" if debug else "" ),
1829
- "eval $(reana-dev client-setup-environment) && reana-dev run-example" ,
1830
1906
]:
1831
1907
run_command (cmd , "reana" )
1908
+ # build cluster
1909
+ cmd = "reana-dev cluster-build"
1910
+ if exclude_components :
1911
+ cmd += " --exclude-components {}" .format (exclude_components )
1912
+ for arg in build_arg :
1913
+ cmd += " -b {0}" .format (arg )
1914
+ if debug :
1915
+ cmd += " --debug"
1916
+ if no_cache :
1917
+ cmd += " --no-cache"
1918
+ run_command (cmd , "reana" )
1919
+ # deploy cluster
1920
+ cmd = "reana-dev cluster-deploy"
1921
+ if debug :
1922
+ cmd += " --debug"
1923
+ for job_mount in job_mounts :
1924
+ cmd += " -j {}" .format (job_mount )
1925
+ run_command (cmd , "reana" )
1926
+ # run demo examples
1927
+ cmd = "eval $(reana-dev client-setup-environment) && reana-dev run-example"
1928
+ for component in components :
1929
+ cmd += " -c {}" .format (component )
1930
+ run_command (cmd , "reana" )
1832
1931
1833
1932
1834
1933
@cli .command (name = "client-setup-environment" )
@@ -2029,7 +2128,7 @@ def run_example(
2029
2128
"mounts" ,
2030
2129
multiple = True ,
2031
2130
callback = volume_mounts_to_list ,
2032
- help = "Which local directories would be mounted in the Kind nodes? local_path:cluster_node_path" ,
2131
+ help = "Which local directories to mount in the cluster nodes? [ local_path:cluster_node_path] " ,
2033
2132
)
2034
2133
@click .option (
2035
2134
"--debug" ,
@@ -2039,9 +2138,15 @@ def run_example(
2039
2138
)
2040
2139
@click .option ("--worker-nodes" , default = 0 , help = "How many worker nodes? [default=0]" )
2041
2140
@cli .command (name = "cluster-create" )
2042
- def cluster_create (mounts , debug , worker_nodes ):
2043
- """Create cluster."""
2141
+ def cluster_create (mounts , debug , worker_nodes ): # noqa: D301
2142
+ """Create cluster.
2044
2143
2144
+ \b
2145
+ Example:
2146
+ $ reana-dev cluster-create -m /var/reana:/var/reana
2147
+ -m /usr/share/local/mydata:/mydata
2148
+ --debug
2149
+ """
2045
2150
class literal_str (str ):
2046
2151
pass
2047
2152
0 commit comments