AWS在预测中写入S3存储桶以调用批处理作业

时间:2020-06-10 14:48:09

标签: r amazon-web-services amazon-s3 amazon-sagemaker

当我在使用自定义容器部署的sagemaker中调用端点/批处理作业时,我想在S3中存储一些信息。 例如,在此图像中 enter image description here

在“部署/托管”中,我想将一些对象放入S3容器中,而不仅要读取/ opt / model

例如BYO container R

在plumber.R函数中,我想:

function(req) {

    # Setup locations
    prefix <- '/opt/ml'
    model_path <- paste(prefix, 'model', sep='/')

    # Bring in model file and factor levels
    load(paste(model_path, 'mars_model.RData', sep='/'))

    # Read in data
    conn <- textConnection(gsub('\\\\n', '\n', req$postBody))
    data <- read.csv(conn)
    close(conn)

    # Convert input to model matrix
    scoring_X <- model.matrix(~., data, xlev=factor_levels)

    ####
    SAVE OBJECT IN S3
    #####


    # Return prediction
    return(paste(predict(mars_model, scoring_X, row.names=FALSE), collapse=','))}

我该如何实现?使用aws.s3连接到容器还是其他技术?

编辑:直接在容器内部连接的aws.s3解决方案似乎不起作用

0 个答案:

没有答案