-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't get activity to start #5
Comments
That will start the different loops, but you still need to trigger the workflow with: SimplerWorkflow::Domain["my-test-domain"].start_workflow("my_workflow", "1.0.0", params) You look at an example line at https://github.com/fredjean/swf_example/blob/master/lib/tasks/simpler_workflow.rake#L10 One note is that Simple Workflow requires the input for a task to be a string. It will not accept a Hash. You can however call .to_json on it. |
I just realized that I didn't provide information on how to trigger the workflow in the read me. Thank you for opening this issue! |
I will definitely take a look at the example Rails app. In the meantime, I did modify my simple script to start the activity, but I am getting an odd error from AWS. I, [2013-04-19T15:39:59.850136 #2254] INFO -- : Registering Activity[my_activity,1.0.0] I, [2013-04-19T15:40:01.319606 #2256] INFO -- : Received decision task I, [2013-04-19T15:40:01.322254 #2256] INFO -- : Processing WorkflowExecutionStarted I, [2013-04-19T15:40:01.322447 #2256] INFO -- : Starting the execution of the job. I, [2013-04-19T15:40:01.322887 #2256] INFO -- : Processing DecisionTaskScheduled I, [2013-04-19T15:40:01.323020 #2256] INFO -- : Processing DecisionTaskStarted I, [2013-04-19T15:40:01.432668 #2256] INFO -- : Waiting for a decision task for my_workflow, 1.0.0 listening to my_workflow I, [2013-04-19T15:41:02.231104 #2256] INFO -- : Waiting for a decision task for my_workflow, 1.0.0 listening to my_workflow I, [2013-04-19T15:42:02.637210 #2256] INFO -- : Waiting for a decision task for my_workflow, 1.0.0 listening to my_workflow Script: require 'logger' $logger = Logger.new(STDOUT) require 'simpler_workflow' config_path = File.expand_path(File.dirname(FILE)+"/aws.yml") AWS.config(YAML.load(File.read(config_path))) domain = SimplerWorkflow::Domain["my-domain"] my_activity = domain.register_activity :my_activity, "1.0.0" do perform_activity do |task| my_activity.start_activity_loop my_workflow = domain.register_workflow :my_workflow, '1.0.0' do my_workflow.decision_loop SimplerWorkflow::Domain["my-domain"].start_workflow("my_workflow", "1.0.0", 'my input') |
I'll have a look at it tonight. My guess is that more than one of the forked processes are triggering the workflow. I'll need to try a few things. One thought would be to split the script in two. One contains the definition of the workflow, the other one contains the code that trigger it. |
I can reproduce this error pretty easily, but I am not quite sure what is causing it. I have added code to catch the errors in for the next version of the gem, but it still doesn't quite explain what is happening. |
I tried the rails app, but I actually never see a decision task show up either (thus no hope of getting an activity either). I can find the workflow registered in the SWF console, but no executions at all. I added this to the register_workflow to help debug:
And I never see the log message. But frankly I haven't been able to get this to work via the standard aws gem either: |
Argh, just found it, sorry. I needed to run: to actually fire it. Plus the domain and the flow version are specified in the setup of the flow as well as in the rake task that fires it. Slowly getting there :) |
Sounds like you are making progress! 👍 We need to know the workflow and the version of the workflow so we can get back to SimpleWorkflow and get the right information. There's a lot of code written around that assumption. I have created constants in the past to simplify the lookup of workflows and activities. I just wrapped it in a rake task to make it easy to test. You can just as well trigger it in your rails app via a call back or inline. I still want to figure out why it didn't work when called from within the process that defines the activities and workflow. I am puzzled by that one... |
Very, very slowly... I can only find 5 minutes at a time to look at it... Now I am stuck at the activity poller not picking up the "helllo" activity. I can find it waiting in the SWF console, but the poller doesn't see it. Eventually it times out. Not sure yet.... |
Could you post the code that you are working with? A gist would be good enough... |
Sorry, but I have gotten pretty off-topic on the original issue here.. I actually went back to the basics and picked up the raw aws-sdk again. I think one of my underlying problems is with how SWF deals with restarts in decision pollers and activity pollers. (Not well IMHO). It really likes to hand things to dead pids due to long polling, but then doesn't seem to have a great recovery method. Here is my code: And my question to the AWS forums. |
I have found a bug within the code that register the activities with SWF. It ended up setting the wrong task list name on the activity_type which would explain why the activity didn't get triggered (if you were using the 0.3.0.beta version of the gem or my repo). I have pushed the updated code up. You would need to change the version of the affected activities since this is set at registration time and cannot (afaik) be changed. |
Hey, yeah, that works! Nice! I used this: and the activity runs. Good stuff. Sorry for dragging this github issue in three directions. |
Really interesting work. Looking forward to using it. I cobbled together a full example based on the README to try it out, but I must be missing something. I don't see my activity ever run. Example below.
Output:
I, [2013-04-19T15:15:18.994277 #1732] INFO -- : Registering Activity[my_activity,1.0.0]
I, [2013-04-19T15:15:19.152609 #1733] INFO -- : Starting activity_loop for my_activity
I, [2013-04-19T15:15:19.802186 #1734] INFO -- : Waiting for a decision task for my_workflow, 1.0.0 listening to my_workflow
I, [2013-04-19T15:16:21.106458 #1734] INFO -- : Waiting for a decision task for my_workflow, 1.0.0 listening to my_workflow
I, [2013-04-19T15:17:22.337401 #1734] INFO -- : Waiting for a decision task for my_workflow, 1.0.0 listening to my_workflow
.
.
.
Code:
require 'logger'
$logger = Logger.new(STDOUT)
require 'simpler_workflow'
require 'active_support'
config_path = File.expand_path(File.dirname(FILE)+"/aws.yml")
AWS.config(YAML.load(File.read(config_path)))
domain = SimplerWorkflow::Domain["my-domain"]
my_activity = domain.register_activity :my_activity, "1.0.0" do
on_fail :retry
perform_activity do |task|
logger.info "performing my activity"
end
end
my_activity.start_activity_loop
my_workflow = domain.register_workflow :my_workflow, '1.0.0' do
initial_activity :my_activity, '1.0.0'
on_start_execution do |task, event|
logger.info "on_start_execution"
task.schedule_activity_task my_activity.to_activity_type, :input => { :my_param => 'value'}
end
end
my_workflow.decision_loop
The text was updated successfully, but these errors were encountered: