ericabouaf / aws-swf Goto Github PK
View Code? Open in Web Editor NEWNode.js helpers to access the Amazon SWF API
License: MIT License
Node.js helpers to access the Amazon SWF API
License: MIT License
The code which lets you set the activity type and version looks more like a hack.
https://github.com/neyric/aws-swf/blob/master/lib/decision-response.js#L169
The code should be like, if sometthing is not there then it should set default value. Else it should take what value is supplied. Currently it sets value only if the first parameter does not contain the key "activity".
if(!swfAttributes) {
if(scheduleAttributes.activity) {
ta.activityType = scheduleAttributes.activity;
}
if (typeof ta.activityType === "string") {
ta.activityType = { name: ta.activityType, version: "1.0" };
}
}
If you have a workflow execution history more than what is returned in a single getHistory request, AWS returns with a nextPageToken property. This isn't used by workflow-execution.js to get the next page(s), so an incomplete history is returned.
Presently the version is hardcoded to 1.0
via https://github.com/neyric/aws-swf/blob/master/lib/decision-response.js#L171
ta.activityType = { name: ta.activityType, version: "1.0" };
#35 is a similar issue for this but the author of the issue closed it 8 days after opening it without adding any comments so don't know if there was offline information gleaned, etc.
The decisionTask.eventList object does not have any api for the reason of failure when an activity fails.
As per AWS docs, maxPageSize can take a max value of 100.
http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/frames.html
The example : https://github.com/neyric/aws-swf#creating-a-decider uses a maximum value of 500 and needs to be changed.
Please have a look at detailed question on stack-overflow.
http://stackoverflow.com/questions/33144757/why-is-the-descisiontask-not-receiving-any-task-from-aws-swf-service-swf
My doubt is regarding the decider not able to receive the decision task.
Example: humantask & ec2.runInstances may have long timeouts...
Updating the aws-sdk dependency to the latest will allow:
decisionTask.response.addDecision({
"decisionType":"ScheduleLambdaFunction",
"scheduleLambdaFunctionDecisionAttributes": {
"id": "someid",
"name": "MyLambdaFunction",
"input": "input"
}
});
This allows calling lambda functions as activities... A real nice feature.
Right now fails because the swf model in the aws-sdk does not include the newer lambda task items (ScheduleLambdaFunction,scheduleLambdaFunctionDecisionAttributes).
Clearly schedule_lambda would be a nice addition to the decision-response module as well.
The idea would be to send a 'provider' in the task input.
The Activity Worker could then use different config files depending on the provider value.
(instead of single config.js file at the moment...)
Most of the APIs in the library consistently follow JavaScript naming conventions and uses camel case (parameter and method names).
However, several of the classes have a mixture of snake-case and camel-case method names. For example, DecisionsResponse
has an add_marker()
method and an addDecision()
method. Similarly, EventList()
has a has_timer_event()
method and an eventById()
method.
It would be nice if the public API of the library consistently used camel case for method names. For backwards compatibility, the existing snake-case function names should be kept as (deprecated) aliases.
https://github.com/neyric/aws-swf/wiki/Writing-deciders
scheduleAttributes.name
is required
activity
can be a String or Object
I'd like access to APIs for cancelling a WorkflowExecution (i.e. requestCancelWorkflowExecution) and to test the EventList whether a cancel has been requested (i.e. a WorkflowExecutionCancelRequested
event has been recorded).
Specifically, I'd hope to see the following:
WorkflowExecution.requestCancel()
methodEventList.requested_cancel_workflow()
method (though not sure about the name)Refer
https://github.com/neyric/aws-swf/blob/master/lib/decision-response.js#L262
The start_timer method uses the "name" parameter as control information. Instead, we should call it "control". Reason: We can add a JSON message to this parameter, which will enable us to implement different strategies like:
ExponentialBackoff
LinearBackoff
.....
In my current use case, I will be implementing my own exponential strategy for retries, however need to add the state for the same as control information.
http://docs.aws.amazon.com/amazonswf/latest/apireference/API_TimerStartedEventAttributes.html
So that decider can evaluate next delay and fire the timer again.
SignalExternalWorkflowExecution
I noticed that after long idle of a few hours, both activity worker and decider stop processing requests. The requests are submitted to SWF, but they aren't processed. I was able to reproduce this repeatedly. No errors occur on the client, just nothing is being processed.
decisionTask.eventList.failed(activityId) returns false when this activityId is in fact failed.
I tried to trace the code through the debugger, and the way it is implemented right now, activityIdFor in event-list.js on line 19 receives scheduledEventId === undefined
I was able to fix this issue by doing this:
has_schedule_activity_task_failed: function (activityId) {
return this._has_eventType_for_activityId(activityId, 'ScheduleActivityTaskFailed');
},
I've run into issue that instance of my SWF decider got response from AWS saying:
ValidationException: Specified token has exceeded its maximum lifetime
It happened after around 4 days of running.
Maybe it's not related, but before this error the decider receives another one for the few times (2x):
UnknownResourceFault: Unknown decision task
Does anyone run into this issue?
we are experiencing a behaviour in our decider (and activity) worker where a new pollForDecisionTask
connection is created (identified from aws client logging) every time a new workflow instance is created.
When the worker is first deployed we see log like the following every 60 seconds (default long polling period)
[AWS swf 200 60.289s 0 retries] pollForDecisionTask({ domain: 'dev',
taskList: { name: '...' },
identity: '...',
maximumPageSize: 100,
reverseOrder: false })
after we start a new workflow execution, and the decider go through its logic and activities then we start seeing another log for pollForDecisionTask
.
Is that the expected behaviour ? or is there some kind of clean up we need to do when the execution is suppose to be terminated ?
we have been fighting this issue for a while now, as the time goes the response time for task.response.respondCompleted
become very very slow (5 mins +).
Thanks a lot for the library and default activities - works great.
One question, which I was not able to do yet... Is it possible to define a loop based on array returned as a result from the previous step and start a child process for each element of the array as input data for the child workflow.
Thanks a lot,
Vladimir
I notice that EventList instances have a private _events
property that contains the raw event history provided by SWF. It would be very useful to me if this was exposed, perhaps as a get_history
method that would return a clone of the array. Would you be open to a pull request for this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.