Ruby 需要在aws数据管道中运行bash脚本
我需要在aws数据管道中使用bash脚本调用ruby文件 我已尝试将shell命令活动与命令参数一起使用 json文件 sample.rb 我不知道如何给出s3路径(“命令”:“bash-lc'cd~/pipeline\u test(bucket\u name)/inputs/&&ruby-sample.rb”, ) 我正在获取脚本退出状态1Ruby 需要在aws数据管道中运行bash脚本,ruby,amazon-web-services,amazon-data-pipeline,Ruby,Amazon Web Services,Amazon Data Pipeline,我需要在aws数据管道中使用bash脚本调用ruby文件 我已尝试将shell命令活动与命令参数一起使用 json文件 sample.rb 我不知道如何给出s3路径(“命令”:“bash-lc'cd~/pipeline\u test(bucket\u name)/inputs/&&ruby-sample.rb”, ) 我正在获取脚本退出状态1 帮助我解决这个问题。实现这一点的一种方法是使用包装器shell脚本,类似下面调用“sample.rb”的脚本 $INPUT1\u STAGING\u DI
帮助我解决这个问题。实现这一点的一种方法是使用包装器shell脚本,类似下面调用“sample.rb”的脚本
$INPUT1\u STAGING\u DIR/sample.rb>$OUTPUT1\u STAGING\u DIR/output.txt
现在,您可以指定指向S3中shell脚本的“脚本Uri”,而不是指定“command”
您还应该启用“Stage=true”,并使输入数据节点指向包含sample.rb脚本的s3文件夹
可以找到有关登台的更多详细信息
您需要修改sample.rb,并使用适当的路径,如“$INPUT1\u STAGING\u DIR/text.txt”,而不是给出“text.txt”
希望这有帮助
> {
> "objects": [
> {
> "terminateAfter": "1 Hours",
> "id": "ResourceId5",
> "schedule": {
> "ref": "ScheduleId4"
> },
> "name": "Resource1",
> "logUri": "s3://pipeline_test/output1/",
> "type": "Ec2Resource"
> },
> {
> "id": "ActivityId1",
> "schedule": {
> "ref": "ScheduleId4"
> },
> "name": "Shell",
> "command": "bash -lc 'cd ~/pipeline_test/inputs/ && ruby sample.rb'", # bash command script path for ruby file
> "runsOn": {
> "ref": "ResourceId5"
> },
> "type": "ShellCommandActivity",
> "output": {
> "ref": "DataNodeId3"
> }
> },
> {
> "id": "DataNodeId3",
> "schedule": {
> "ref": "ScheduleId4"
> },
> "directoryPath": "s3://pipeline_test/output/",
> "name": "Output",
> "type": "S3DataNode"
> },
> {
> "id": "Default",
> "scheduleType": "timeseries",
> "name": "Default",
> "role": "DataPipelineDefaultRole",
> "resourceRole": "DataPipelineDefaultResourceRole"
> },
> {
> "id": "ScheduleId4",
> "startDateTime": "2013-08-01T00:00:00",
> "name": "schedule",
> "type": "Schedule",
> "period": "20 Minutes",
> "endDateTime": "2013-08-03T00:00:00"
> }
> ]
> }
f = File.open('text.txt', 'a+')
old_out = $stdout
$stdout = f
puts "Start time #{Time.now}"
puts "Welcome"
puts "End time #{Time.now}"
f.close