【发布时间】:2019-10-19 08:15:58
【问题描述】:
在我的 akka scala 代码中,我试图操纵由相同代码创建的文件。
工艺流程
1. create a file A
2. use file A and create file B
3. use file B and do some mapping and create an ouput file
现在在创建第 1 步之前,第 2 步正在执行,并且与第 3 步类似的问题
请注意:第 1 步和第 2 步需要花费 2 分钟左右的时间。 为了处理这种情况,我放了 Thread.sleep 让代码进入第 2 步,但是第 2 步 更耗时,并且放置 thread.sleep(5000) 会引发 Akka 超时错误。
有没有办法优雅地处理问题。
我的要求的要点是我想按顺序运行该步骤。
下面的实际代码
val tmpDir = "src/main/resources/"
logger.debug("Import all documents to mallet...")
Text2Vectors.main(("--input " + tmpDir + "new_corpus/ --keep-sequence --remove-stopwords " + "--output " + tmpDir + "new_corpus.mallet --use-pipe-from " + tmpDir + "corpus.mallet").split(" "))
logger.debug("Run training process...")
Thread.sleep(10000)
InferTopics.main(("--input " + tmpDir + "new_corpus.mallet --inferencer " + tmpDir + "inferencer " + "--output-doc-topics " + tmpDir + "doc-topics-new.txt --num-iterations 1000").split(" "))
Thread.sleep(50000)
logger.debug("Inferring process finished.")
【问题讨论】:
-
这里的未来在哪里?阿卡在哪里?谁在消费这些结果?这没有任何意义