I have a spark streaming application whichI am working on a FileStream..the stream would have two main action which I need to call the second one exactly when the first one is finished
dstrea.foreachRDD(action1)
dstream.foreachRDD(action2)
action 1 update some information into hbase...while acton 2 read from those information so in each batch action 2 shroud be run after action1
I wanted to know how to achieve this functionality?
you can try to combine the two action in one foreachRDD function:
dstream.foreachRDD(rdd=>{
action1
action2
})
Related
How can I pass 2 condition in a while loop on Jmeter. The conditions are
The request should run in loop till "Pass" response comes.
While loop should run only for 1 minute.
Condition 1 is working fine. However condition 2 is unable to implement.
I have tried running the While Loop inside a Runtime Controller. But the issue is, if the response "Pass" comes before 1 min, the rest of the test stops.
Tried other way round (Runtime inside While Loop) leading to numerous execution of the request, even after receiving "Pass" response.
Will appreciate any leads on this. Thanks
Add a JSR223 Sampler just before the While Controller and store the current time into a JMeter Variable using the following code:
SampleResult.setIgnore()
vars.putObject('whileLoopStart', System.currentTimeMillis())
Use the following __groovy() function as the While Controller's condition:
${__groovy(!vars.get('your_variable').equals('Pass') && ((System.currentTimeMillis() - vars.getObject('whileLoopStart')) < 60000),)}
This way the While Controller will run until:
either your_variable is not equal to Pass
or 60 seconds pass
whatever comes the first
More information on Groovy scripting in JMeter: Apache Groovy - Why and How You Should Use It
This could be another solution.
You can achieve the desired outcome with the following components.
Runtime Controller
If Controller
Flow Control Action
Set the Runtime (duration) in the Runtime Controller
Set the first condition you already have in While Controller in the If Controller
Click the Break Current Loop to exist from the Run Time controller
I have a spring batch with reader/processor/writer. which works perfectly fine. The new requirement is the processor should process only 1 or 2 message and sleep for 1 or 2 sec depending on the load in the server (My item-processor calls 3rd party API to send some data, the 3rd party calls should not be continuous).
I have implemented chunk listener, but i m not able to identify how to read the message/item-process call,
chunklistener "readcount" returns the number of message processed in incremental.
paramChunkContext.getStepContext().getStepExecution().getReadCount() //chunkcontext
One option that i m thinking of is to divide the chunkcount/2 and based on the return(if return is 0 - sleep for 1 sec). then
thread.sleep(1000) //
Is there any other better way to perform this? the above process is a dirty job.
I'm in Shiny, RStudio. I'm making an app that processes a user input in several steps, each step taking input from the previous step. At each step the user can set several parameters to process the input.
The workflow looks like this:
Step1: upload input from user
obj_step1 <- eventReactive(input$actionButton1, {#function to upload input from user})
output$step1 <- renderPlot({#function to display obj_step1})
Step2:
obj_step2 <- eventReactive(input$actionbutton2, {#function to process obj_step1, taking several user given parameters from the ui with input$})
output$step2 <- renderPlot({#function to display obj_step3})
Step3:
obj_step3 <- eventReactive(input$actionbutton3, {#function to process obj_step2, taking several user given parameters from the ui with input$})
output$step3 <- renderPlot({#function to display obj_step3})
Step4:
obj_step4 <- eventReactive(input$actionbutton4, {#function to process obj_step3, taking several user given parameters from the ui with input$})
output$step4 <- renderPlot({#function to display obj_step4})
My problem: the user has gone through all the steps and concludes that, to get the best results, he needs to restart the process from step 2, with new parameters. How do I remove all the objects and outputs from the step3-4, to ensure that no mix up takes place?
I've tried remove(obj_step4()), but it does not support this type of objects.
After some days running around in circles, I found the reactiveValues() function from shiny (http://shiny.rstudio.com/articles/). It helps to empty the objects from eventReactive functions when an actionButton of a previous step is pressed. For more details follow the link to the manual pages.
Basically the first script runs correctly on the Web (Action 1) . This inputted information is transferred from the web to a terminal emulator (backend non QTP related). → Done
A second action is then used on the terminal emulator to complete/test information.
So in effect, there are two scripts:
Action 1 for the web,
Action 2 for the emulator
The script for the terminal emulator also runs fine.
So the problem is this:
I don't want to call the Action 2 until Action 1 is complete (simple I arrange the actions in order they are to fire). → Done
However, I want the Action 2 to run off the datasheet from Action 1. I don't want to have to copy all the information manually from Action 1 to Action 2. Usually this is simple, as I can use the setRow(), getRow() methods. But the Action 2 datasheet is blank (as Action 1 has all the data). I can't run the Action 2, because there are no literation to run (again the datasheet in Action 2 is blank). QTP just reverts back to Action 1, because it thinks as there are now entries on Action 2, then Action 2 is complete.
All I want to do is associate Action 2 directly with the datasheet in Action 1. I don't want to simply extend the code to Action 1, because users will be moving consistently between Action 1 and Action 2.
So in a nut shell, is there
a code to copy all datasheet contents from Action 1 to Action 2 (but do this only once, not on every iteration) so that Action two can run on what ever row I choose from?
a simple way to associate the code of Action 2 to the Datasheet data of Action 1?
a way to use a library function file rather than action to run the datasheet information associated with Action 1?
Consider using Datatable.ImportSheet and programmatically import your test data.
Please note that, you will have to change your current row for every iteration. It should be on the start of your test... Something like
If DataTable.GetRowCount > DataTable.GetCurrentRow Then
DataTable.SetCurrentRow = DataTable.GetCurrentRow + 1
End If
I used similar to the above. Using the datatable.getCurrentRow method allowed me to access the correct row on the second spreadsheet
I have a JMeter Test Plan with following structure
Test Plan
**ThreadGroup1**
--CSV Data Config-001
----SimpleController
--------------LoginRequest
--------------Action-abc-Request
**ThreadGroup2**
--CSV Data Config-002
----SimpleController
--------------LoginRequest
--------------Action-xyz-Request
I have two CSV files which contain list of users like this..
**CSV-001**
Username1
Username2
.. ..
Username50
**CSV-002**
Username51
Username52
.. ..
Username100
In my scenario, I need to run a load test with say 100 users. 50 users login from ThreadGroup1 and other 50 users login from ThreadGroup2. Users from both threadgroups login simultaneously.
Currently, I have to go through process of manually creating/editing these CSV files whenever I change the number of total users.
Please suggest if there are any alternative time-saving & performance-efficient approaches through I which can fulfill my scenario requirements (without using CSV files).
I will appreciate, if you can explain the alternative solution with some details as I am quite new to JMeter stuff. Thanks.
Another idea is to use
Username${__threadNum}
for the first thread group and
Username${__BeanShell(ctx.getThreadNum()+Z+1)}
for the second, where Z equals the total number of threads in thread group 1. You also need to add 1 since ctx.getThreadNum() returns a thread number using a 0 based index, whereas the __threadNum function is 1 based.
You can use a counter in each thread. The start value for the counter in the first thread would be 1, in the second 51. Be sure the 'Track counter independently for each user' check box is unchecked.
If you set the reference names to thread1Count and thread2Count respectively, you can use
Username${thread1Count}
for the first thread and
Username${thread2Count}
for the second.