小编Jac*_*tat的帖子

为气流中的日志设置s3

我正在使用docker-compose来设置可扩展的气流群集.我的解决方案基于这个Dockerfile https://hub.docker.com/r/puckel/docker-airflow/

我的问题是将日志设置为从s3写入/读取.当一个dag完成后,我得到这样的错误

*** Log file isn't local.
*** Fetching here: http://ea43d4d49f35:8793/log/xxxxxxx/2017-06-26T11:00:00
*** Failed to fetch log file from worker.

*** Reading remote logs...
Could not read logs from s3://buckets/xxxxxxx/airflow/logs/xxxxxxx/2017-06-
26T11:00:00
Run Code Online (Sandbox Code Playgroud)

我在这个airflow.cfg文件中设置了一个新的部分

[MyS3Conn]
aws_access_key_id = xxxxxxx
aws_secret_access_key = xxxxxxx
aws_default_region = xxxxxxx
Run Code Online (Sandbox Code Playgroud)

然后在远程日志部分中指定s3路径 airflow.cfg

remote_base_log_folder = s3://buckets/xxxx/airflow/logs
remote_log_conn_id = MyS3Conn
Run Code Online (Sandbox Code Playgroud)

我是否正确设置了这个并且有错误?这里有成功的秘诀吗?

- 更新

我尝试以URI和JSON格式导出,似乎都不起作用.然后我导出了aws_access_key_id和aws_secret_access_key,然后气流开始捡起它.现在我在工作日志中得到了他的错误

6/30/2017 6:05:59 PMINFO:root:Using connection to: s3
6/30/2017 6:06:00 PMERROR:root:Could not read logs from s3://buckets/xxxxxx/airflow/logs/xxxxx/2017-06-30T23:45:00
6/30/2017 6:06:00 PMERROR:root:Could not write logs to s3://buckets/xxxxxx/airflow/logs/xxxxx/2017-06-30T23:45:00
6/30/2017 6:06:00 …
Run Code Online (Sandbox Code Playgroud)

python amazon-s3 airflow

33
推荐指数
3
解决办法
2万
查看次数

用ggplot扩展密度图

我看到这个五十岁的情节很好,不同学院的密度图略有重叠.请访问fivethirtyeight.com查看此链接

你会如何用ggplot2复制这个情节?

具体来说,如何轻微重叠, facet_wrap无法正常工作.

TestFrame <-  
  data.frame(
    Score =
      c(rnorm(100, 0, 1)
        ,rnorm(100, 0, 2)
        ,rnorm(100, 0, 3)
        ,rnorm(100, 0, 4)
        ,rnorm(100, 0, 5))
    ,Group =
      c(rep('Ones', 100)
        ,rep('Twos', 100)
        ,rep('Threes', 100)
        ,rep('Fours', 100)
        ,rep('Fives', 100))
  )

ggplot(TestFrame, aes(x = Score, group = Group)) +
  geom_density(alpha = .75, fill = 'black')
Run Code Online (Sandbox Code Playgroud)

部分覆盖密度

plot r ggplot2

7
推荐指数
1
解决办法
1193
查看次数

Rcpp排名函数,平均联系

我有一个自定义的等级函数,我从这里偷了(有一些修改):) 等级函数的Rcpp sugar

问题是,它确实关系密切,我需要平均关系

这是我所拥有的

#include <Rcpp.h>
using namespace Rcpp;

// [[Rcpp::export]]
NumericVector sort_rcpp(NumericVector x) {
  std::vector<double> tmp = Rcpp::as< std::vector<double> > (x);
  std::sort(tmp.begin(), tmp.end());
  return wrap(tmp);
}

// [[Rcpp::export]]
IntegerVector rank_(NumericVector x) {
  return match(x, sort_rcpp(x));
}


/*** R
x <- c(1:5, 1:5)

rank(x, ties = 'average')
rank(x, ties = 'min')
rank_(x)
*/
Run Code Online (Sandbox Code Playgroud)

将其保存到文件后,运行此命令可获得结果

Rcpp::sourceCpp('~/Documents/Rank.cpp')
Run Code Online (Sandbox Code Playgroud)

哪个返回

# x <- c(1:5, 1:5)
#
# # what I need
# rank(x, ties = 'average')
# [1] 1.5 3.5 5.5 7.5 9.5 …
Run Code Online (Sandbox Code Playgroud)

r rcpp

3
推荐指数
1
解决办法
410
查看次数

当2个大的正数乘以时,Rcpp返回大的负数

我正在创建一个计算曲线下面积的函数,当我取2个部分并将它们乘以我超过的分子时2^31,然后-2013386137在计算中使用一个值.

这是cpp块

#include <Rcpp.h>
using namespace Rcpp;


// [[Rcpp::export]]
NumericVector sort_rcpp(NumericVector x) {
  std::vector<double> tmp = Rcpp::as< std::vector<double> > (x);
  std::sort(tmp.begin(), tmp.end());
  return wrap(tmp);
}

// [[Rcpp::export]]
IntegerVector rank(NumericVector x) {
  return match(x, sort_rcpp(x));
}

// [[Rcpp::export]]
double auc_(NumericVector actual, NumericVector predicted) {

  double n = actual.size();

  IntegerVector Ranks = rank(predicted);
  int NPos = sum(actual == 1);
  int NNeg = (actual.size() - NPos);

  int sumranks = 0;

  for(int i = 0; i < n; ++i) { …
Run Code Online (Sandbox Code Playgroud)

r rcpp

0
推荐指数
1
解决办法
100
查看次数

标签 统计

r ×3

rcpp ×2

airflow ×1

amazon-s3 ×1

ggplot2 ×1

plot ×1

python ×1