Buildbot has too many pending jobs and has stopped building at all - buildbot

I encountered a problem in which buildbot has too many pending jobs and has stopped doing any more builds. Even when I restart the buildbot, the pending jobs do not go away. I want to be able to do the build and remove the pending jobs. How can i do that?

To be able to cancel pending builds you must have this feature enabled in the
authz.Authz setting in the master.cfg file of your buildmaster,e.g.
authz_cfg=authz.Authz(
# change any of these to True to enable; see the manual for more
# options
gracefulShutdown = False,
forceBuild = True,
forceAllBuilds = False,
pingBuilder = False,
stopBuild = True,
stopAllBuilds = False,
cancelPendingBuild = True,
)
Documentation here
Once you've done that you'll need to restart your buildmaster. Then, on the web-status
page of any builder, you'll see buttons to cancel any pending builds as well
as the running build.

Related

Cannot get coc-java to work offline with gradle

I am trying to get coc-java to work in an environment where I don't have internet access. I generated my setup with internet access and transferred it to the offline environment, but when I open a java file and do :CocCommand workspace.showOutput and choose coc-java, I get a stacktrace beginning with Cannot download published Gradle versions. at org.eclipse.buildship.core.internal.util.gradle.PublishedGradleVersions.downloadVersionInformation(PublishedGradleVersions.java:165)...Caused by: java.net.UnknownHostException: services.gradle.org. I have gradle 7.4.2 already installed, and have the following settings in ~/.vim/coc-settings.json:
"java.enabled" : true,
"java.autobuild.enabled": true,
"java.codeGeneration.generateComments": true,
"java.implementationsCodeLens.enabled": true,
"java.referencesCodeLens.enabled": true,
"java.completion.enabled" : true,
"java.foldingRange.enabled" : true,
"java.format.comments.enabled" : true,
"java.format.enabled" : true,
"java.format.onType.enabled" : true,
"java.home" : "/usr/java/jdk-11.0.2",
"java.import.gradle.enabled": true,
"java.import.gradle.offline.enabled": true,
"java.import.gradle.home": "/home/me/.opt/gradle/gradle-7.4.2",
"java.import.gradle.user.home": "/home/me/.gradle",
"java.import.gradle.version": "7.4.2",
"java.import.gradle.wrapper.enabled": false,
"java.import.maven.enabled": true,
"java.progressReports.enabled" : false,
"java.trace.server": "verbose",
"java.configuration.runtimes": [
{
"name": "JavaSE-11",
"path": "/usr/java/jdk-11.0.2",
"default": true
}
]
The coc-java docs says this about java.import.gradle.home: Use Gradle from the specified local installation directory or GRADLE_HOME if the Gradle wrapper is missing or disabled and no 'java.import.gradle.version' is specified.
I've tried removing java.import.gradle.version as well, but same issue occurs.
Given that the stacktrace mentions eclipse buildship, I've tried Googling how to change eclipse/buildship settings, but haven't been able to find out how to configure offline settings, if that's even possible. Has anyone been able to get coc-java to work offline with gradle?
TL;DR
Place the gradle-bin zip file in $GRADLE_USER_HOME/wrapper/dists/gradle-<some-version>-bin/<some-hash>/
Long Version
I finally managed to hack my way around it. Even with the two properties set in coc-settings.json:
"java.import.gradle.offline.enabled": true,
"java.import.gradle.wrapper.enabled": false,
... It still seemed to be trying to fetch gradle-7.1.1 from services.gradle.org. After taking a look in $GRADLE_USER_HOME, I noticed a wrapper directory, despite never using gradle-wrapper for anything, so I dug deeper. After a lot of playing around, I managed to get it to work by taking a gradle-7.4.2-bin.zip file I already had and placing it in $GRADLE_USER_HOME/wrapper/dists/gradle-7.1.1-bin/f29rtwfnc96ub43tt7p47zsru/. I'm not sure the significance of that hash value nor why it would point to version 7.1.1 of gradle, but after putting the zip file there and opening a java file, it proceeded to create the gradle-7.4.2 folder under that hash folder with everything needed underneath, and coc commands started to work!

Can I close terminal while waiting waiting for App Store Connect to finish processing the new build?

I am using fastlane to build and upload ipa to iTC with submitting for review flag true.
when complete uploading,iTC need time to process the ipa.Normally,it takes one hour.Then Fastlane will request submitting for review.
My question is,when fastlane continuously output 'Waiting for App Store Connect to finish processing the new build',can I close the terminal,or I must keep it alive?
Here is my fastlane action
lane :build_app_store do
build_app(
export_method: "app-store",
export_options: PROVISION_PROFILE_APP_STORE,
output_directory: OUTPUT_DIRECTORY,
silent: true,
clean: true,)
appstore(force: true, # Skip HTMl report verification
skip_screenshots:true,
skip_metadata: true,
app_identifier: "com.app.cn",
submit_for_review: false,
phased_release: true)
end
Yes you can close the terminal and you can use this action to be notified when the process is finished: https://github.com/fastlane/watchbuild
It's not a replacement for deliver or pilot, it's just a utility which triggers a notification when the process is finished

ECS/Fargate - can I schedule a job to run every 5 minutes UNLESS its already running?

I've got an ECS/Fargate task that runs every five minutes. Is there a way to tell it to not run if the prior instance is still working? At the moment I'm just passing it a cron expression, and there's nothing in the cron/rate aws doc about blocking subsequent runs.
Conseptually I'm looking for something similar to Spring's #Scheduled(fixedDelay=xxx) where it'll run every five minutes after it finishes.
EDIT - I've created the task using cloudformation, not the cli
This solution works if you are using Cloudwatch Logging for your ECS application
- Have your script emit a 'task completed' or 'script successfully completed running' message so you can track it later on.
Using the describeLogStreams function, first retrieve the latest log stream. This will be the stream that was created for the task which ran 5 minutes ago in your case.
Once you have the name of the stream, check the last few logged events (text printed in the stream) to see if it's the expected task completed event that your stream should have printed. Use the getLogEvents function for this.
If it isn't, don't launch the next task and invoke a wait or handle as needed
Schedule your script to run every 5 minutes as you would normally.
API links to aws-sdk docs are below. This script is written in JS and uses the AWS-SDK (https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS.html) but you can use boto3 for python or a different lib for other languages
API ref for describeLogStreams
API ref for getLogEvents
const logGroupName = 'logGroupName';
this.cloudwatchlogs = new AwsSdk.CloudWatchLogs({
apiVersion: '2014-03-28', region: 'us-east-1'
});
// Get the latest log stream for your task's log group.
// Limit results to 1 to get only one stream back.
var descLogStreamsParams = {
logGroupName: logGroupName,
descending: true,
limit: 1,
orderBy: 'LastEventTime'
};
this.cloudwatchlogs.describeLogStreams(descLogStreamsParams, (err, data) => {
// Log Stream for the previous task run..
const latestLogStreamName = data.logStreams[0].logStreamName;
// Call getLogEvents to read from this log stream now..
const getEventsParams = {
logGroupName: logGroupName,
logStreamName: latestLogStreamName,
};
this.cloudwatchlogs.getLogEvents(params, (err, data) => {
const latestParsedMessage = JSON.parse(data.events[0].message);
// Loop over this to get last n messages
// ...
});
});
If you are launching the task with the CLI, the run-task command will return you the task-arn.
You can then use this to check the status of that task:
aws ecs describe-tasks --cluster MYCLUSTER --tasks TASK-ARN --query 'tasks[0].lastStatus'
It will return RUNNING if it's still running, STOPPED if stopped, etc.
Note that Fargate is very aggressive about harvesting stopped tasks. If that command returns null, you can consider it STOPPED.

Karma: no cache on file server

When I do some setup on my test suite, I sometimes need to debug the produced html file.
The good thing is, there is a debug feature:
In order to do that, I run karma start --no-single-run.
But on every file change I make, I need to kill the process and restart it, otherwise, cached files are served:
How can I prevent the server from caching in this specific situation? Anyways, most of the time I run in single-run mode so caching hasn't much interest for me.
Thanks
--auto-watch may help:
karma start --no-single-run --auto-watch
If you change some files, karma-runner will reload (and cache) them, then it will run tests again automatically. If you refresh debug.html page after that, you will get a new version of these files without restarting karma-runner.
If you have this issue when running the tests in IntelliJ have a look at this workaround.
function runTests() {
var serverPort = cli.getServerPort();
var urlRoot = cli.getUrlRoot() || '/';
if (urlRoot.charAt(urlRoot.length - 1) !== '/') {
urlRoot = urlRoot + '/';
}
runWithConfig({
port: serverPort,
refresh: false, // set this flag to true
urlRoot: urlRoot
});
}
It's a known, not yet fixed issue in the karma-intellij plugin.

Buildbot slaves priority

Problem
I have set up a latent slave in buildbot to help avoid congestion.
I've set up my builds to run either in permanent slave or latent one. The idea is the latent slave is waken up only when needed but the result is that buildbot randomly selectes one slave or the other so sometimes I have to wait for the latent slave to wake even if the permanent one is idle.
Is there a way to prioritize buildbot slaves?
Attempted solutions
1. Custom nextSlave
Following #david-dean suggestion, I've created a nextSlave function as follows (updated to working version):
from twisted.python import log
import traceback
def slave_selector(builder, builders):
try:
host = None
support = None
for builder in builders:
if builder.slave.slavename == 'host-slave':
host = builder
elif builder.slave.slavename == 'support-slave':
support = builder
if host and support and len(support.slave.slave_status.runningBuilds) < len(host.slave.slave_status.runningBuilds):
log.msg('host-slave has many running builds, launching build in support-slave')
return support
if not support:
log.msg('no support slave found, launching build in host-slave')
elif not host:
log.msg('no host slave found, launching build in support-slave')
return support
else:
log.msg('launching build in host-slave')
return host
except Exception as e:
log.err(str(e))
log.err(traceback.format_exc())
log.msg('Selecting random slave')
return random.choice(buildslaves)
And then passed it to BuilderConfig.
The result is that I get this in twistd.log:
2014-04-28 11:01:45+0200 [-] added buildset 4329 to database
But the build never starts, in the web UI it always appear as Pending and none of the logs I've put appear in twistd.log
2. Trying to mimic default behavior
I've having a look to buildbot code, to see how it is done by default.
in file ./master/buildbot/process/buildrequestdistributor.py, class BasicBuildChooser you have:
self.nextSlave = self.bldr.config.nextSlave
if not self.nextSlave:
self.nextSlave = lambda _,slaves: random.choice(slaves) if slaves else None
So I've set exactly that lambda function in my BuilderConfig and I'm getting exactly the same build not starting result.
You can set up a nextSlave function to assign slaves to a builder in a custom manner see: http://docs.buildbot.net/current/manual/cfg-builders.html#builder-configuration