Camunda A/B Testing - camunda

Anybody has experience with A/B testing in Camunda. For Example, if I have two external tasks, which ties to a front screen say built in React. How do we make Camunda go to one external task 80% of the time vs 20% of the time to other one.
Thank you!

Untested: Assuming you are using spring/boot you can use an expression in the "topic" field of the external task property in your bpmn.
That expression then could dynamically define the topic to be used.
Now randomTopicGenerator could be a bean which rollDice() method returns topic name topic-name-v1 and topic-name-v2 by using an 80/20 random function.
You than start two external-task-workers, one for each topic.
When you make the topic-name structure and the ratio configurable, you can later disable the old topic.

Related

High level PHP library for Amazon SWF deciders to check state of activity tasks

I'm writing PHP for fairly simple workflow for Amazon SWF. I've found myself starting to write a library to check if certain actions have been started or completed. Essentially looping over the event list to check how things have progressed, and then starting an appropriate activity if its needed. This can be a bit faffy at times as the activity type and input information isn't in every event, it seems to be in the ActivityTaskScheduled event. This sort of thing I've discovered along the way, and I'm concerned that I could be missing subtle things about event lists.
It makes me suspect that someone must have already written some sort of generic library for finding the current state of various activities. Maybe even some sort of more declarative way of coding up the flowcharts that are associated with SWF. Does anything like this exist for PHP?
(Googling hasn't come up with anything)
I'm not aware of anything out there that does what you want, but you are doing it right. What you're talking about is coding up the decider, which necessarily has to look at the entire execution state (basically loop through the event list) and decide what to do next.
Here's an example written in python
( Using Amazon SWF To communicate between servers )
that looks for events of type 'ActivityTaskCompleted' to then decide what to do next, and then, yes, looks at the previous 'ActivityTaskScheduled' entry to figure out what the attributes for the previous task were.
If you write a php framework that specifies the workflow in a declarative way then a generic decider that implements it, please consider sharing it :)
I've since found https://github.com/cbalan/aws-swf-fluent-php which looks promising, but not really used it, so can't speak to the whether it works or not.
I've forked it and started a bit of very light refactoring to allow some testing, available at https://github.com/michalc/aws-swf-fluent-php

Multiple HITs or ExternalQuestion in Mechanical Turk?

First of all I must say I am totally new to MT so forgive me if I am thinking in a totally wrong way.
I have to create a task for workers where they have to classify a sentence if it is spam or if it falls into a certain category. I will have about 2500 sentences to classify a day.
What is the best way to use the API to do this. I understand how to create a HIT using the API, but it is my understanding that I can't create a recurrent HIT that changes itself once each of the sentence is classified. Do I need to create 2500 HITs?
I researched and found out about the External Question which I can setup in my server and make it change with each form submit.
In that case will it be just 1 HIT? is that the correct way to do this?
I am confused in the dynamic part of MT.
Any tip, documentation (updated) or suggestion will be appreciated.
Thanks!
You likely want to create separate HITs.
If you create an single External HIT (hosted on your server), a
MTurk Worker who takes your HIT will not be eligible to take another
task (e.g. a classification task) since Workers are not allowed to
take a single HIT more than once. However, if you create separate
HITs, a Worker can take as many of them as they wish, which is
probably what you want.
You are correct that you cannot automatically change a HIT
dynamically unless it is run on your own server.

Profiling Wicket applications

Are there any good tools or techniques to profile Wicket applications? What I'm looking for is something that would give me a breakdown of what's happening inside Wicket while processing a request.
It doesn't have to be as fancy as Spring insight.
I'm new to Wicket and all the anonymous inner classes spread around everywhere makes it very hard to see when things are happening.
At least for Wicket 1.4 one can take a look at the internal method org.apache.wicket.RequestCycle.steps(). Basically, this is the place where a request that has been identified as a request to the Wicket application is walked through the relevant steps of the Wicket request processing cycle. In the beginning of the class RequestCycle, the main steps are represented each by an int constant. The higher the int value, the later the step comes within the cycle. The method RequestCycle.step() that gets called from RequestCycle.steps() has a switch statement to delegate the different steps to the responsible framework methods which delegate further down.
The steps, or phases if you like, in the request cycle are in order:
NOT_STARTED - initial value
PREPARE_REQUEST - preparation for further processing, calls onBeginRequest
RESOLVE_TARGET - determine the relevant request target
PROCESS_EVENTS - process events, set current step to RESPOND and respond as well
RESPOND - only respond, used in case of redirects
DETACH_REQUEST - trigger the detach hooks by delegation
DONE - becomes the current value after DETACH_REQUEST
What is actually happening inside the steps is determined by the implementations of various interfaces, most notably IRequestCycleProcessor and IRequestTarget.
See
org.apache.wicket.response.filter.ServerAndClientTimeFilter
org.apache.wicket.response.filter.AjaxServerAndClientTimeFilter
org.apache.wicket.devutils.inspector.RenderPerformanceListener
org.apache.wicket.protocol.http.RequestLogger
All these give some measurements but also see my comment of Cedric Gatay's response.
Using tools like Yourkit (http://www.yourkit.com) will help you a lot for this task.
You can profile using jvisualvm like any other Java application. With a correct class filter set you will be able to see what is time consuming in your code and hopefully correct it.
I found that wicket-devutils ships with a panel called DebugBar that provides access to a lot of debug information.
It can be seen in action here: http://wicket.apache.org/apidocs/1.4/org/apache/wicket/devutils/debugbar/DebugBar.html

How do you model a business workflow in ColdFusion?

Since there's no complete BPM framework/solution in ColdFusion as of yet, how would you model a workflow into a ColdFusion app that can be easily extensible and maintainable?
A business workflow is more then a flowchart that maps nicely into a programming language. For example:
How do you model a task X that follows by multiple tasks Y0,Y1,Y2 that happen in parallel, where Y0 is a human process (need to wait for inputs) and Y1 is a web service that might go wrong and might need auto retry, and Y2 is an automated process; follows by a task Z that only should be carried out when all Y's are completed?
My thoughts...
Seems like I need to do a whole lot of storing / managing / keeping
track of states, and frequent checking with cfscheuler.
cfthread ain't going to help much since some tasks can take days
(e.g. wait for user's confirmation).
I can already image the flow is going to be spread around in multiple UDFs,
DB, and CFCs
any opensource workflow engine in other language that maybe we can port over to CF?
Thank you for your brain power. :)
Study the Java Process Definition Language specification where JBoss has an execution engine for it. Using this Java based engine may be your easiest solution, and it solves many of the problems you've outlined.
If you intend to write your own, you will probably end up modelling states and transitions, vertices and edges in a directed graph. And this as Ciaran Archer wrote are the components of a State Machine. The best persistence approach IMO is capturing versions of whatever data is being sent through workflow via serialization, capturing the current state, and a history of transitions between states and changes to that data. The mechanism probably needs a way to keep track of who or what has responsibility for taking the next action against that workflow.
Based on your question, one thing to consider is whether or not you really need to represent parallel tasks in your solution. Where instead it might be possible to en-queue a set of messages and then specify a wait state for all of those to complete. Representing actual parallelism implies you are moving data simultaneously through several different processes. In which case when they join again you need an algorithm to resolve deltas, which is very much a non trivial task.
In the context of ColdFusion and what you're trying to accomplish, a scheduled task may be necessary if the system you're writing needs to poll other systems. Consider WDDX as a serialization format. JSON, while seductively simple, I recall has some edge cases around numbers and dates that can cause you grief.
Finally see my answer to this question for some additional thoughts.
Off the top of my head I'm thinking about the State design pattern with state persisted to a database. Check out the Head First Design Patterns's Gumball Machine example.
Generally this will work if you have something (like a client / order / etc.) going through a number of changes of state.
Different things will happen to your object depending on what state you are in, and that might mean sitting in a database table waiting for a flag to be updated by a user manually.
In terms of other languages I know Grails has a workflow module available. I don't know if you would be better off porting to CF or jumping ship to Grails (right tool for the job and all that).
It's just a thought, hope it helps.

Stress testing a web service method with Powershell

I want to stress test a web service method by calling it several thousand times in quick succession. The method has a single string parameter that I will vary on each call.
I'm planning on writing a Powershell script to loop and call this method a number of times.
Is there a better way to do this?
If you run call after call - it's not going to help you too much, as it will not show you how the service behaves under a heavy load of many simultaneous connections.
Go with some multi-threaded solution (I do not know if powershell has this).
Some opensource testing tools are listed here. Just set your web service to accept GET requests as well, not only SOAP(default), so you can form the urls.
For these situations I would use JMeter. You need to play around with it first, but it is very flexible, it will run requests in different threads, it will display the results graphically and it also allows you to script your jobs.
I would also recommend to start it not in the same machine as the server and if possible start two or more instances in different machines to simulate the load.
Personally, I'd use something like openSTA.
This allows a session with a web site to be recorded and then played back via a relatively simple script language.
You can also easily test web services and write your own scripts.
It allows you to put scripts together in a test in any way you want and configure the number of iterations, the number of users in each iteration, the ramp up time to introduce each new user and the delay between each iteration. Tests can also be scheduled in the future.
It's open source and free.
It produces a number of reports which can be saved to a spreadsheet. We then use a pivot table to easily analyse and graph the results.
It really depends on if there are other requirements. Such as logging, history, etc.
If quick and dirty is all you need, then you're good.
If you need something more robust then you can look at either custom building a test harness in the language of your choice or using things such as Mercury, MS Team Tester, nUnit or the like.
For those that stumble upon this and don't want to use the 3rd party options already mentioned. As the accepted answer mentions, a multi-threaded solution is best, this can be achieved in PowerShell:
ForEach -Parallel ($item in $collection) { }
https://learn.microsoft.com/en-us/powershell/module/psworkflow/about/about_foreach-parallel
Although the number of threads could be limited to 5: Does powershell's parallel foreach use at most 5 thread?