我正在尝试使用编译InfluxDB数据库(版本v0.8.8) go get github.com/influxdb/influxdb
但这会拉动主分支,我需要v0.8.8标签.
我试图这样做: go get github.com/influxdb/influxdb/releases/tag/v0.8.8但是这说不能说找不到.
我还尝试定期go get执行master分支,然后使用gitin 手动检出标记GOPATH/src/github...以设置corret版本.
使用最后一种方法的问题是,当我尝试使用go get -u -f ./...它来拉动依赖项时,尝试在主分支中找到它们,并且其中一些在主分支上不存在...
TL; DR:go get对特定的github标记执行,并提取正确的依赖项.
我正在使用Spring Boot构建一个Command Line java应用程序,以使其快速运行.
应用程序加载不同类型的文件(例如CSV)并将它们加载到Cassandra数据库中.它不使用任何Web组件,它不是Web应用程序.
我遇到的问题是在工作完成后停止应用程序.我使用Spring CommandLineRunner接口@Component来运行任务,如下所示,但是当工作完成后,应用程序不会停止,它会因某种原因而继续运行,我找不到阻止它的方法.
@Component
public class OneTimeRunner implements CommandLineRunner {
@Autowired
private CassandraOperations cassandra;
@Autowired
private ConfigurableApplicationContext context;
@Override
public void run(String... args) throws Exception {
// do some work here and then quit
context.close();
}
}
Run Code Online (Sandbox Code Playgroud)
更新:问题似乎是spring-cassandra,因为项目中没有其他内容.有谁知道为什么它保持线程在后台运行,阻止应用程序停止?
更新:更新到最新的春季启动版本后问题消失了.
我正在使用Spring WebFlux创建一个项目.
在过去,我曾使用StreamingResponseBody流式响应回客户端,但我找不到WebFlux中的等价物.
例:
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
@GetMapping("/video")
public StreamingResponseBody stream() {
InputStream videoStream = ...
StreamingResponseBody res = (os) -> { IOUtils.copy(videoStream, os); }
return res;
}
Run Code Online (Sandbox Code Playgroud)
是否有相当于StreamingResponseBodyWebFlux?或者,我应该导入传统的Spring MVC并混合它们吗?
编辑:到目前为止,我通过访问ServerHttpResponse(下面的示例)来解决它.但我仍然想知道更好的解决方案.
@GetMapping("/video")
fun stream2(response: ServerHttpResponse): Mono<Void> {
val factory = response.bufferFactory()
val publisher = videoStream
.observeVideoParts()
.map { factory.wrap(it.bytes) }
return response.writeWith(publisher)
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试构建一个由 Spring Boot 应用程序和 PostgreSQL 数据库组成的“服务”。当 Spring Boot 应用程序在我的本地机器上运行时,我已经能够从 Spring Boot 应用程序访问数据库(在容器中运行)。现在,当我尝试将 Spring Boot 应用程序移动到容器时,收到以下错误:
inventory_1 | 2018-01-20 18:43:06.108 ERROR 1 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection] with root cause
inventory_1 |
inventory_1 | java.net.ConnectException: Connection refused (Connection refused)
Run Code Online (Sandbox Code Playgroud)
但是,我可以从本地机器连接到数据库:
psql -h localhost -p 5000 -U kelly_psql -d …
这可能是一个基本问题,但是我找不到解决方案:
我需要计算张量的均值,而忽略任何非有限值。
例如mean([2.0, 3.0, inf, 5.0])应该返回,3.333而不是infnor 2.5。
我已经尝试过,sess.run(tf.reduce_mean([2.0, 3.0, inf, 5.0]))但它会返回inf。
我正在观察 a 产生的线条NetworkResource,将其包裹在Observable.create. 这是代码,为简单起见,缺少 try/catch 和取消:
fun linesOf(resource: NetworkResource): Observable<String> =
Observable.create { emitter ->
while (!emitter.isDisposed) {
val line = resource.readLine()
Log.i(TAG, "Emitting: $line")
emitter.onNext(line)
}
}
Run Code Online (Sandbox Code Playgroud)
问题是,后来我想将它变成一个Flowable使用observable.toFlowable(LATEST)添加背压的情况下,我的消费跟不上,但根据我怎么做,消费者停止项目128后接收项目。
A)这样一切正常:
val resource = ...
linesOf(resource)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.toFlowable(BackpressureStrategy.LATEST)
.subscribe { Log.i(TAG, "Consuming: $it") }
Run Code Online (Sandbox Code Playgroud)
B)这里消费者在 128 件物品后被卡住(但发射仍在继续):
val resource = ...
linesOf(resource)
.toFlowable(BackpressureStrategy.LATEST)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe { Log.i(TAG, "Consuming: $it") } // <-- stops after 128
Run Code Online (Sandbox Code Playgroud)
在选项A) 中,一切正常,没有任何问题,我可以看到 …
java ×3
spring ×3
kotlin ×2
spring-boot ×2
android ×1
docker ×1
git ×1
github ×1
go ×1
numpy ×1
postgresql ×1
python ×1
rx-java ×1
rx-java2 ×1
spring-mvc ×1
tensorflow ×1