Repository: jina-ai/serve
Pull request: docs: replace usages of parallel
closes: https://github.com/jina-ai/jina/issues/3748

Problem statement:
Replace use of parallel in examples and docs
We deprecated the use of `parallel` in favor of the more explicit `replicas` and `shards`.  Before `parallel` could mean both `replicas` and `shards` depending on its usage. Now it is an alias for `shards` for backwards compatibility (because replicas has less features), but should no longer be advertised.

In Core's code base this should be replaced in most places already, but there might other places where it is still advertised. This ticket is about finding those places and replace the usage with the appropriate option (shards or replicas).

In particular we should check:
* examples
* docs
* readme of Core repo

Hints from issue discussion:

Commit message: docs: replace usages of parallel

Patch to review:
diff --git a/README.md b/README.md
index 1aec67752578f..ce5d2a9906587 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@ Jina<sup><a href=".github/pronounce-jina.mp3">`🔊`</a></sup> is a neural searc
 ⏱️ **Save time** - *The* design pattern of neural search systems, from zero to a production-ready system in minutes.
 
 🌩️ **Fast & cloud-native** - Distributed architecture from day one, scalable & cloud-native by design: enjoy
-containerizing, streaming, paralleling, sharding, async scheduling, HTTP/gRPC/WebSocket protocols.
+containerizing, streaming, sharding, replicating, async scheduling, HTTP/gRPC/WebSocket protocols.
 
 🍱 **Own your stack** - Keep end-to-end stack ownership of your solution, avoid integration pitfalls you get with
 fragmented, multi-vendor, generic legacy tools.
@@ -99,7 +99,7 @@ class Indexer(Executor):
     def bar(self, docs: DocumentArray, **kwargs):
          docs.match(self._docs, metric='euclidean')
 
-f = Flow(port_expose=12345, protocol='http', cors=True).add(uses=CharEmbed, parallel=2).add(uses=Indexer)  # build a Flow, with 2 parallel CharEmbed, tho unnecessary
+f = Flow(port_expose=12345, protocol='http', cors=True).add(uses=CharEmbed, shards=2).add(uses=Indexer)  # build a Flow, with 2 shard CharEmbed, tho unnecessary
 with f:
     f.post('/index', (Document(text=t.strip()) for t in open(__file__) if t.strip()))  # index all lines of _this_ file
     f.block()  # block for listening request
diff --git a/docs/fundamentals/clean-code.md b/docs/fundamentals/clean-code.md
index 3118fb5126690..720af3bc6b2fa 100644
--- a/docs/fundamentals/clean-code.md
+++ b/docs/fundamentals/clean-code.md
@@ -286,7 +286,7 @@ class MyExecutor(Executor):
         for doc in docs:
             doc.convert_image_uri_to_blob()  # conversion happens inside Flow
 
-f = Flow().add(uses=MyExecutor, parallel=2)
+f = Flow().add(uses=MyExecutor, shards=2)
 
 def my_input():
     image_uris = glob.glob('/.workspace/*.png')
diff --git a/docs/tutorials/fuzzy-grep.md b/docs/tutorials/fuzzy-grep.md
index 6dd5826b4d2aa..a51407bee817c 100644
--- a/docs/tutorials/fuzzy-grep.md
+++ b/docs/tutorials/fuzzy-grep.md
@@ -81,8 +81,8 @@ class Indexer(Executor):
 from jina import Flow
 
 f = (Flow(port_expose=12345, protocol='http', cors=True)
-        .add(uses=CharEmbed, parallel=2)
-        .add(uses=Indexer))  # build a Flow, with 2 parallel CharEmbed, tho unnecessary
+        .add(uses=CharEmbed, shards=2)
+        .add(uses=Indexer))  # build a Flow, with 2 shard CharEmbed, tho unnecessary
 
 ```
 
diff --git a/docs/tutorials/refactor-hello-world.md b/docs/tutorials/refactor-hello-world.md
index c38004ff42336..dc10af63e70df 100644
--- a/docs/tutorials/refactor-hello-world.md
+++ b/docs/tutorials/refactor-hello-world.md
@@ -24,7 +24,7 @@ Now that you understand how to use public Executor from Hub, let's practice our
       Flow()
       .add(uses='jinahub+docker://ImageTorchEncoder',
          uses_with={'model_name': 'alexnet'},
-         parallel=2)
+         shards=2)
       .add(uses=MyConverter)
       .add(uses=MyIndexer, workspace=args.workdir)
       .add(uses=MyEvaluator)
@@ -56,10 +56,10 @@ use [TransformerTorchEncoder](https://github.com/jina-ai/executor-transformer-to
 2) Change lines 21 to 25 from `app.py` to define a different `Flow`. Change it to:
     ```python
     Flow(cors=True)
-    .add(uses=MyTransformer, parallel=args.parallel)
+    .add(uses=MyTransformer, replicas=args.replicas)
     .add(
         uses='jinahub+docker://TransformerTorchEncoder',
-        parallel=args.parallel,
+        replicas=args.replicas,
         uses_with={
             'pretrained_model_name_or_path': 'sentence-transformers/paraphrase-mpnet-base-v2'
         },


Code review comments:
diff_hunk: @@ -99,7 +99,7 @@ class Indexer(Executor):
     def bar(self, docs: DocumentArray, **kwargs):
          docs.match(self._docs, metric='euclidean')
 
-f = Flow(port_expose=12345, protocol='http', cors=True).add(uses=CharEmbed, parallel=2).add(uses=Indexer)  # build a Flow, with 2 parallel CharEmbed, tho unnecessary
+f = Flow(port_expose=12345, protocol='http', cors=True).add(uses=CharEmbed, shards=2).add(uses=Indexer)  # build a Flow, with 2 shard CharEmbed, tho unnecessary
path: README.md
text: @user1:
here, use `replicas`. No `data` involved so it is more coherent to what we describe in our `Topology` section

diff_hunk: @@ -30,7 +30,7 @@ Jina<sup><a href=".github/pronounce-jina.mp3">`🔊`</a></sup> is a neural searc
 ⏱️ **Save time** - *The* design pattern of neural search systems, from zero to a production-ready system in minutes.
 
 🌩️ **Fast & cloud-native** - Distributed architecture from day one, scalable & cloud-native by design: enjoy
-containerizing, streaming, paralleling, sharding, async scheduling, HTTP/gRPC/WebSocket protocols.
+containerizing, streaming, sharding, replicating, async scheduling, HTTP/gRPC/WebSocket protocols.
path: README.md
text: @user1:
I think the better word is replication?