You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "WeichenXu123 (via GitHub)" <gi...@apache.org> on 2023/03/30 10:36:47 UTC
[GitHub] [spark] WeichenXu123 commented on a diff in pull request #40607: [WIP][ML] Make Torch Distributor support Spark Connect
WeichenXu123 commented on code in PR #40607:
URL: https://github.com/apache/spark/pull/40607#discussion_r1153066202
##########
python/pyspark/ml/torch/distributor.py:
##########
@@ -581,11 +593,11 @@ def _run_distributed_training(
f"Started distributed training with {self.num_processes} executor proceses"
)
try:
+ assert self.spark is not None
result = (
- self.sc.parallelize(range(self.num_tasks), self.num_tasks)
- .barrier()
- .mapPartitions(spark_task_function)
- .collect()[0]
+ self.spark.range(start=0, end=self.num_tasks, step=1, numPartitions=self.num_tasks)
+ .mapInPandas(func=spark_task_function, schema="output binary", barrier=True)
+ .first()["output"]
Review Comment:
I think barrier mode task does not support `.first()` operation if I remember it correctly
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org