Spring Cloud Dataflow Composed Task Runner not terminating on Kubernetes - spring-cloud-dataflow

I am using Spring Cloud Dataflow Server 2.9.6 to run a composed task on Kubernetes. The individual tasks run fine and terminate. The composed task runner, however does not terminate. The pod stays alive.
I noticed, that for a similar task, that is launched via task launcher stream application, the compound task runner terminates as expected when I pass the command line argument --spring.cloud.task.closecontextEnabled=true in the task launch request.
I did not manage to set that variable from the UI when manually launching a composed task.
In the docs, there is a separate section for Ctr Properties, see here: https://dataflow.spring.io/docs/2.9.x/feature-guides/batch/composed-task/#launch-the-composed-task-definition There is a composed-task-app-properties to set in the doc's screen shot. But for me, this section is not showing when launching the composed task.
Is there a way for setting the composed task runner arguments from the UI? Or is there a way to set this automatically? For me, it does not make sense to keep the CTR process alive by default. What's the reason for this?

Related

batch-job example in spring cloud dataflow

batch-job example seems doesn't works when I try deployed it in SpringCloudDataFlow local.
To make test I've used spring-cloud-task 1.2.1.RELEASE and cloud-dataflow-server-local-1.2.3.RELEASE.
To make test I've follow these steps:
Build spring-cloud-task-samples/batch-job
Register application in spring dataflow with url
maven://io.spring.cloud:batch-job:jar:1.2.1.RELEASE and Type Task
from task tab define task without parameter
run it
When I say 'seems doesn't works' I mean that in stdout.log I was waiting "Job1 was run" instead, I don't find nothing and stderr was empty.
Am I doing something wrong ?
Thanks for help

How to use Ant Script to Start and Stop JMeter test

I'm new to JMeter and Ant and my web searches have not been fruitful so I'm posing a question here: Is it possible to start and stop a JMeter script using Ant?
Here's what I'm trying to do:
I have a JMeter test plan with a loop in it that is to simulate a user (or several users) sitting on a page for an indeterminate amount of time after a page refresh. In JMeter GUI mode, I can schedule the thread group to spin up users at a specified time and continue doing so for a specified duration. I'd ideally run this script for 45 minutes or so, stop the script and analyze the results. I would like to automate the running of this script and Ant seemed like the way to go. I did not see an appropriate property to specify a start time or a duration when running the script. Does such a thing exist? Is there a suitable workaround? Any help that can be offered is greatly appreciated.
There is a JMeter Ant Task available. You can kick off your Test Plan using this Task according to documentation.
For 45 minutes test duration I would go for the following:
<jmeter
jmeterhome="/path/to/your/JMeter/installation"
testplan="/path/to/your/test/plan.jmx"
resultlog="/path/to/your/test/results.jtl">
<property name="duration" value="2700"/>
</jmeter>
And put ${__P(duration,)} into Thread Group Scheduler's "Duration" input field
Once you start Ant JMeter will pick up that "duration" property and ask threads to stop when 2700 seconds (45 minutes) pass. Remember that in case of high number of threads shut down process may not be immediate as JMeter might need some time to gracefully shut down all the test threads.
For detailed explanation on using JMeter Ant Task and few more options of running tests in non-GUI mode see 5 Ways To Launch a JMeter Test without Using the JMeter GUI guide.
From what have you written I think you want to schedule a test from non-gui mode and control the parameters also. I am not sure about ant but we have workaround.
For this you can use JMeter non-gui features
If you want to start a test then you can use
Jmeter.bat/.sh -n -t
You can stop the test using stoptest.bat/.sh and shutdown.bat/.sh at any time (Maybe a wrapper shell/batch script can help you to automate this)
For specifying parameters you can override the existing parameters by specifying them from command line as properties local/global like,
-D[prop_name]=[value] - defines a java system property value
-J[prop name]=[value] - defines a local JMeter property
and use these properties in your test plan so that you can pass values while running the test for a specific amount of time or infinitely and stop the test in between (like you said after 45 min) using stoptest.bat/.sh
Example,
In Thread Group set Number of Threads to ${__property(users,,)} and specify it from command line as,
jmeter -Jusers=50 -n -t Test_Plan.jmx
Remember this local property and not global.
For using properties and non-gui mode you can refer this, Jmeter Manual

How to enforce synchronous execution of separate Jenkins jobs?

Our Jenkins server is configured with two primary jobs to build apks. Each of those jobs has a child job that installs the APK onto an Android device that is attached to the build server and executes UI tests.
For example:
Project-A-apk
Project-A-tests
Project-B-apk
Project-B-tests
where
Project-A-apk kicks off Project-A-tests
Project-B-apk kicks off Project-B-tests
and
both Project-A-tests and Project-B-tests install and run on the same test device.
The issue is, we can't have the test jobs running at the same time, as they will both try to interact with the same device.
Is there a way to configure a job to wait until some other job (not in it's parent chain) before executing?
I use the Throttle Concurrent Builds Plugin to control when jobs should run concurrently.
Setup a category name such as android-device with Maximum Concurrent Builds Per Node set to 1. Assign this category to the jobs that run the test on the android device. Once the plugin is installed there is a place to assign the category on the job configuration page.
All jobs with the same category name assigned will execute serially instead of concurrently.
We use the Jenkins Exclusion Plugin to manage our builds that have to share a couple of different DB resources. This plug works by allowing you to define Critical Blocks in your build steps. Critical blocks will only run if they can acquire a specific resource. At the end of the block the resource is released. This means that you don't have to block an entire job, just the parts that you need the resource for.
You should try the Build Blocker Plugin:
This plugin keeps the actual job in the queue if at least one name of
currently running jobs is matching with one of the given regular
expressions.
Another way would be to limit the number of Jenkins executors to one. This would ensure that only one job is running and other wait in queue. However, this might block other future jobs that do not access the test device.
One more: Heavy Job Plugin
You can weight your Android jobs to block all executors.

How can I configure execution start between dependent jobs?

My Jenkins server is set up with two jobs A and B say.
Job A is triggered from changes in subversion, runs unit tests and if successful, creates a WAR and deploys it to another environment.
If Job A succeeds, then Job B triggers. This job runs tests against the deployed WAR.
The problem is that the deployment process takes a while and the WAR is not ready in time for when Job B starts and tries to use it.
I'm looking for ideas on how to delay Job B until the WAR is up and running.
Is there a way, once Job B is triggered to wait for x seconds? I really don't want to put it into the tests in Job B if I can avoid it.
Thanks
There is definitely a way for a job to wait - just put sleep into the first shell build step. Alternatively, you can set 'Quiet period' - it's in Advanced Project Options when you create a build.
That, however, is a band-aid solution to be employed only if other approaches fail. You may try the following: if there is a way to make the deployment process (that job A triggers) right before it finishes to touch a file that Jenkins has access to, then you can use FSTrigger Plugin. See use case 3 there.
The most reliable way to make this work would be to make job A not complete until the deployment is successful, e.g. by testing for a valid response from the URL of the deployed web app. This blog post describes one way to do that.

Update Quartz.NET Job DLL without Service Restart

I just started with Quartz.net and I have it running as a service. I created a Job and moved the resulting .dll to the Quartz folder and added a new entry to the jobs.xml file to kick it off every 3 seconds.
I updated the job .dll but it is in use by Quartz (or is locked).
Is it possible to update the .dll without restarting the Quartz service? If not what would happen to a long running job if I did stop/start the Quartz service?
You cannot update the job dll without restarting the service. Once the server has started it loads the the job dll and the loaded types stay in memory. This is how .NET runtime works. To achieve something like dynamic reloading you would need to use programmatically created app domains etc.
If you stop the scheduler you can pass a bool parameter whether to wait for jobs to complete first. Then you would be safe with jobs completing and no new ones would spawn meanwhile the scheduler is shutting down.

Resources