我有API网关调用Lamdba函数1并在Go中调用lambda函数2.我想看到服务地图中加入了这两个功能.
到目前为止,我能够做到这一点的唯一方法是创建一个自定义段,例如称为"父",并从此上下文创建一个子段,例如称为"子".然后使用client.InvokeWithContext调用函数2传递"子"段上下文.
sess := session.Must(session.NewSession())
client := lambda.New(sess, &aws.Config{Region: aws.String(region)})
xray.Configure(xray.Config{LogLevel: "trace"})
xray.AWS(client.Client)
ctx, seg := xray.BeginSegment(context.Background(), "Parent")
ctx, subseg := xray.BeginSubsegment(ctx, "Child")
result, _ := client.InvokeWithContext(ctx,
lambda.InvokeInput{FunctionName: aws.String(functionName), Payload: nil})
subseg.Close(nil)
seg.Close(nil)
Run Code Online (Sandbox Code Playgroud)
问题是这会在服务地图中创建跟踪父 - >子,但也有功能1.
请在服务地图上加入这两个功能的最佳方法是什么?注意.我有超过2个,我想看到服务地图上的链接,向我展示我通过lambdas的整个流程.
请帮忙.
谢谢里克
我试图找到一种在网页中查找重复模式的方法,以便我可以将内容提取到我的数据库中.
编辑:我不知道重复模式是什么,所以我不能只通过正则表达式或其他东西搜索给定的模式.
例如,如果你有10个网站销售汽车,但网站都是不同的,在每个网站上查看汽车以重复的方式在该网站的页面上以html列出.
其他网站将以不同的方式列出,但每个网站都有重复的模式.
有谁知道这种事情是怎么样的,或有任何经验?
我喜欢红宝石所以如果有人知道或者知道任何可能帮助我的宝石/宝石,我希望能用红宝石吗?
我正在尝试通过 Resque 后台作业在后台创建 PDF 文档。
我用于创建 PDF 的代码位于 Rails 辅助方法中,我想在 Resque 工作线程中使用该方法,例如:
class DocumentCreator
@queue = :document_creator_queue
require "prawn"
def self.perform(id)
@doc = Document.find(id)
Prawn::Document.generate('test.pdf') do |pdf|
include ActionView::Helpers::DocumentHelper
create_pdf(pdf)
end
end
end
Run Code Online (Sandbox Code Playgroud)
该create_pdf
方法来自DocumentHelper
但我收到此错误:
undefined method `create_pdf'
Run Code Online (Sandbox Code Playgroud)
有人知道怎么做吗?
我使用默认驱动程序与我的authlogic成员区域进行了所有的capybara测试,但是当我更改一个测试以使用selenium驱动程序,因为它有ajax,它给出了我的theis错误:
You must activate the Authlogic::Session::Base.controller with a controller object before creating objects
Run Code Online (Sandbox Code Playgroud)
事情正在使用authlogic的默认驱动程序,所以必须与selenium有关?
我在spec_helper中包含了Authlogic :: TestCase
activate_authlogic
domain.user_sessions.create(user)
Run Code Online (Sandbox Code Playgroud)
在每个之前.
有人帮我这个吗?
谢谢里克
我有回形针工作上传和保存图像的不同样式但是当我使用来自railscasts教程的jcrop来裁剪图像时它不会裁剪图像.我收到这个错误
[paperclip] identify -format %wx%h '/var/folders/z+/z+KzOZBFE9irCpbMKKBGFk+++TI/-Tmp-/paperclip-reprocess20110118-19757-1wtrjaj-0[0]' 2>/dev/null
[paperclip] convert '/var/folders/z+/z+KzOZBFE9irCpbMKKBGFk+++TI/-Tmp-/paperclip-reprocess20110118-19757-1wtrjaj-0[0]' -crop 28x32+13+15-resize "400x400>" '/var/folders/z+/z+KzOZBFE9irCpbMKKBGFk+++TI/-Tmp-/paperclip-reprocess20110118-19757-1wtrjaj-020110118-19757-1a5n558-0.jpg' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::PaperclipError: There was an error processing the thumbnail for paperclip-reprocess20110118-19757-1wtrjaj-0>
Run Code Online (Sandbox Code Playgroud)
这是在rails 2.3.9中工作但是hvae刚刚升级到rails 3.0.3我已经获得了所有最新的宝石等.
cropper.rb文件如下所示,位于初始化程序目录中
module Paperclip
class Cropper < Thumbnail
def transformation_command
if crop_command
crop_command + super.join(" ").sub(/ -crop \S+/, '')
else
super
end
end
def crop_command
target = @attachment.instance
if target.cropping?
" -crop #{target.crop_w.to_i}x#{target.crop_h.to_i}+#{target.crop_x.to_i}+#{target.crop_y.to_i}"
end
end
end
end
Run Code Online (Sandbox Code Playgroud)
尺寸正在进入这个但实际上没有裁剪图像.
请任何人都可以帮忙吗?
非常感谢Richard Moss