2017年2月28日星期二

2017年2月27日星期一

spring boot data jpa: operations allowed after connection closed连接异常

参考http://www.jianshu.com/p/1626d41572f2

#以下为连接池的相关参数配置
spring.datasource.primary.max-idle=10
spring.datasource.primary.max-wait=10000
spring.datasource.primary.min-idle=5
spring.datasource.primary.initial-size=5
spring.datasource.primary.validation-query=SELECT 1
spring.datasource.primary.test-on-borrow=false
spring.datasource.primary.test-while-idle=true
spring.datasource.primary.time-between-eviction-runs-millis=18800

2017年2月26日星期日

spring boot打包错误Unable to find a single main class from the following candidates

因为spring发现了多个类似@SpringBootApplication的入口类,解决方法:
在pom.xml的<properties></properties>中增加:
<start-class>your/main/class</start-class>

参考:http://www.jianshu.com/p/b521f819b06a

2017年2月25日星期六

gitlab-ctl restart或stop时候postgresql timeout问题

ps -ef | grep postgresql
杀掉 runsv postgresql 这个进程和相关的其他进程

gitlab-ctl reconfigure

gitlab check检查

参考了http://g23988.blogspot.hk/2015/07/gitlabtimeout-down-postgresql-0s.html

gitlab-rake gitlab:check

可以根据该命令的输出按照说明fix一些问题。

2017年2月16日星期四

sbt test ERROR SparkContext: Error initializing SparkContext.

参考http://stackoverflow.com/questions/41887273/sparkcontext-error-running-in-sbt-there-is-already-an-rpcendpoint-called-localb

sbt默认同时运行所有的test,但spark context只能有一个。

在build.sbt中增加:
parallelExecution in Test := false

解决问题。

sbt assembly忽略test

参考http://stackoverflow.com/questions/20131854/sbt-assembly-jar-exclusion

sbt 'set test in assembly := {}' clean assembly

配置sbt镜像

sbt默认的镜像经常下载失败,简单查了一下设置其他镜像的方法:

修改系统环境变量:export SBT_OPTS="-Dsbt.override.build.repos=true"

vim ~/.sbt/repositories,增加:
[repositories]
    local
    repo2:http://repo2.maven.org/maven2/
    ivy-typesafe:http://dl.bintray.com/typesafe/ivy-releases, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
    ivy-sbt-plugin:http://dl.bintray.com/sbt/sbt-plugin-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]

没有深入研究,有空再系统看下。

下面的链接给了一些镜像,可以试下效果:
http://www.jianshu.com/p/c8c48b0b3866
https://gist.github.com/ysrotciv/267f05270a2cfab084c123316c0a82ee

2017年2月13日星期一

Mac中Beyond Compare激活

vim /Applications/Beyond\ Compare.app/Contents/Resources/trial.key,将内容替换为windows版本的key:
--- BEGIN LICENSE KEY ---
H1bJTd2SauPv5Garuaq0Ig43uqq5NJOEw94wxdZTpU-pFB9GmyPk677gJ
vC1Ro6sbAvKR4pVwtxdCfuoZDb6hJ5bVQKqlfihJfSYZt-xVrVU27+0Ja
hFbqTmYskatMTgPyjvv99CF2Te8ec+Ys2SPxyZAF0YwOCNOWmsyqN5y9t
q2Kw2pjoiDs5gIH-uw5U49JzOB6otS7kThBJE-H9A76u4uUvR8DKb+VcB
rWu5qSJGEnbsXNfJdq5L2D8QgRdV-sXHp2A-7j1X2n4WIISvU1V9koIyS
NisHFBTcWJS0sC5BTFwrtfLEE9lEwz2bxHQpWJiu12ZeKpi+7oUSqebX+
--- END LICENSE KEY -----

重启Beyond Compare。

目前该方法已经无效,参考https://gist.github.com/huqi/35f2a0792aef830898ca 中最新的方法。

2017年2月9日星期四

spark运行时java.io.IOException: No space left on device

参考http://stackoverflow.com/questions/25707784/why-does-a-job-fail-with-no-space-left-on-device-but-df-says-otherwise

修改%SPARK_HOME/conf/spark-defaults.conf,增加spark.local.dir SOME/DIR/WHERE/YOU/HAVE/SPACE

Exclude dependency from maven assembly plugin

在<dependency>...</dependency>中增加<scope>provided</scope>即可。

tensorflow serving 0.5.0新特性

tensorflow serving 0.5.0中使用的tensorflow版本为0.12.0。

0.5.0的tensorflow_model_server默认从use_saved_model=false变为了use_saved_model=true,注意这个问题。
SessionBundle已经过时,在后面的tensorflow serving 1.0版本中官方将不再支持。

tensorflow serving server运行时SSE4.1不支持的问题

tensorflow serving 0.5.0版本,编译成功后,运行tensorflow_model_server后报错:
2017-02-08 22:06:49: F external/org_tensorflow/tensorflow/core/platform/cpu_feature_guard.cc:35] The TensorFlow library wa
s compiled to use SSE4.1 instructions, but these aren't available on your machine.
Aborted (core dumped)

查了相关issue:https://groups.google.com/a/tensorflow.org/forum/#!msg/discuss/qCbVWKa4GU0/6PC3x8TtEQAJ
http://stackoverflow.com/questions/41474136/disable-sse4-1-when-compiling-tensorflow/41477681#41477681

解决方法:
删除serving/tensorflow/tensorflow/tensorflow.bzl文件中的if_x86(["-msse4.1"]) + 这行

2017年2月7日星期二

tensorflow serving运行tensorflow/configure的问题

tensorflow serving 0.5.0版本,运行configure时报错:
java.lang.RuntimeException: Unrecoverable error while evaluating node 'REPOSITORY_DIRECTORY:@jpeg' (requested by nodes 'RE
POSITORY:@jpeg')

参考了https://github.com/tensorflow/serving/issues/301

解决:
apt-get install ca-certificates-java
update-ca-certificates -f

如果还没有解决,把bazel升级到0.4.4