Airflow - Change Success/Fail colours (colour-blind) - user-interface

I'm looking to implement Airflow as our task handler but one thing that is realllly bothering me is the default success/running/failed colours in the Web UI.
I'm colour-blind red/green (most common) and it's extremely hard to differentiate at a glance for me to the point I'm thinking about not using it.
Is there a way for me to edit the default colours somewhere? bootstrap-theme.css perhaps?
Really really want this to be possible.
Thanks!

After version 1.10.11, new feature added to customize colors.
From doc
To change the colors for TaskInstance/DagRun State in the Airflow
Webserver, perform the following steps:
Create airflow_local_settings.py file and put in on $PYTHONPATH or to
$AIRFLOW_HOME/config folder. (Airflow adds $AIRFLOW_HOME/config on
PYTHONPATH when Airflow is initialized)
Add the following contents to airflow_local_settings.py file. Change
the colors to whatever you would like.
STATE_COLORS = {
"queued": 'darkgray',
"running": '#01FF70',
"success": '#2ECC40',
"failed": 'firebrick',
"up_for_retry": 'yellow',
"up_for_reschedule": 'turquoise',
"upstream_failed": 'orange',
"skipped": 'darkorchid',
"scheduled": 'tan',
}
Restart Airflow Webserver.
See documentation here

Related

Grafana to use substraction of two fields in Elasticsearch data source

I have two fields, called 'status_codes' and requests
I want to get number of failed requests.
My equation is [requests - no of success requests]
In the script i wrote something like this _value - doc['#status_codes.200'].value
BUT the value return in the graph is 'N/A'
I'm using elasticsearch(7.6.0) and Grafana(6.6.2).
Following is the out file which i'm sending to elasticsearch
{ "latencies":{
"total":3981710268690,
"mean":43876078,
"50th":916913,
"90th":2217744,
"95th":5162430,
"99th":60233348,
"max":60000209373,
"min":43652
},
"#version":"1",
"latest":"2020-03-05T16:14:44.23387091Z",
"path":"test23.json",
"duration":61163899322,
"wait":552109,
"status_codes":{
"0":90624,
"200":125
},
"earliest":"2020-03-05T16:13:43.069971588Z",
"rate":1483.702004057131,
"throughput":2.0436707446156577,
"#timestamp":"2020-03-05T16:14:44.453Z",
"errors":[
"Post http://www: dial tcp 0.0.0.0:0->10.133.9.87:8688: socket: too many open files",
"Post http://www: dial tcp: lookup internal-netty-load-balancer-937469711.us-east-1.elb.amazonaws.com on 10.20.30.30: dial udp 10.20.30:45: socket: too many open files"
],
"bytes_in":{
"mean":70.90298515686123,
"total":6434375
},
"requests":90749,
"Report_Title":"test23",
"host":"ABS",
"success":0.0013774256465635985,
"end":"2020-03-05T16:14:44.234423019Z",
"bytes_out":{
"mean":70.90298515686123,
"total":6434375
}
}
Also I have used Singlestat plugin as #yash mentioned, but still i could resolve the issue.
Query section
Visualization section
Can someone help me
This is a fairly easy task. You just need to use either of the 'Singlestat Math' or 'Metaqueries' plugin for that. What you need to do is, use the count metric in two queries in the same panel, one for getting the count of successful status codes, and other for unsuccessful status codes. Then you can use either of the plugin to subtract the value of result of query one query from another.
https://grafana.com/grafana/plugins/blackmirror1-singlestat-math-panel
https://grafana.com/grafana/plugins/goshposh-metaqueries-datasource
I suggest you go with the singlestat math plugin, it would be easier to work with, from my experience.
Note: The calculation (A-B) is done in the visualization section and not in query section, in the singlestat math plugin.
P.S. singlestat-math plugin actually adds a new panel in the visualization section. It's a different panel than the default singlestat panel.
Finally I found the the solution as follow,
solution
Thanks everyone.

How to use computed properties in github actions

I am trying to rebuild my ci-cd within the new github actions yaml format (new), the issue is that I can't seem to use computed values as arguments in a step.
I have tried the following
- name: Download Cache
uses: ./.github/actions/cache
with:
entrypoint: restore_cache
args: --bucket=gs://[bucket secret] --key=node-modules-cache-$(checksum package.json)-node-12.7.0
However "$(checksum package.json)" is not valid as part of an argument.
Please not this has nothing to do with if the command checksum exists, it does exist within the container.
I'm trying to copy this kind of setup in google cloud build
- name: gcr.io/$PROJECT_ID/restore_cache
id: restore_cache_node
args:
- '--bucket=gs://${_CACHE_BUCKET}'
- '--key=node-modules-cache-$(checksum package.json)-node-${_NODE_VERSION}'
I expected to be able to use compute arguments in a similar way to other ci-cd solutions.
Is there a way to do this that I am missing? Maybe being able to use 'run:' within a docker container to run some commands.
The only solution I'm aware of at the moment is to compute the value in a previous step so that you can use it in later steps.
See this answer for a method using set-output. This is the method I would recommend for passing computed values between workflow steps.
Github Actions, how to share a calculated value between job steps?
Alternatively, you can create environment variables. Computed environment variables can also be used in later steps.
How do I set an env var with a bash expression in GitHub Actions?

intersphinx link creation issues for local files across multiple projects

I have a few different Sphinx projects that I would like to refer to each other locally (no web server). I have separate code + build directories setup for the projects and was trying out intersphinx to solve this requirement.
My questions are:
Is there a better way of referring to two or more local projects within Sphinx?
Is there a way to strip out the second build in the path?
In my configuration file I have:
intersphinx_mapping = {
'doc1': ('../build/doc1',None)
}
so I get no issues in doing a make HTML, however when I look at the reference I've created with :ref:'doc1 info <doc1:label1>' I have in the HTML document:
file:///<root path>/build/**build**/doc1/html/doc.html#label1
So the issue is I get two "build" directory listings - it should of been:
file:///<root path>/build/doc1/html/doc.html#label1.
If I manually do this, it correctly pulls in the document.
I've also tried replacing None with '../build/doc1'. If I drop the build from the mapping I do get an error in finding the objects.inv file for doc1.
I do not want to use absolute path since the end user getting this documentation may see it in another location and I want this to be cross platform...
My directory tree is essentially as follows:
Makefile
build/doc1/html
build/doc2/html
doc1
doc2
As a background, I'm trying this under Cygwin with Sphinx 1.7.5... I haven't tried Linux yet to see if I get the same behavior...
You can set a different path for your target and for your inventory.
Maybe you can try something like:
intersphinx_mapping = {
'doc1': ('../doc1', '../build/doc1/objects.inv')
}
If you want to keep the None, it is also possible to have both:
intersphinx_mapping = {
'doc1': ('../doc1', (None, '../build/doc1/objects.inv'))
}

Serilog console conditional output template based on log level, (and low profile color in console)

Please first excuse me, I am not so familiar with the Serilog, I started with it quite recently.
I would like use a certain log level in my console app to be used as normal console output by default (output just the rendered message) and then optionally, when specified by optional commandline argument like -verb also have output in such default format "{Timestamp:HH:mm:ss} [{Level:u3}] {Message}{NewLine}{Exception}"(and additionally perhaps with more low profile color)
My questions are:
which (the cleanest) way can it be accomplished?
a) in case of filtering: can you please help me, how the filtering would look like in the fluent configuration API?
b) in case of using a custom ITextFormater, can it somehow inherit the part
providing rendering such format templates as mentioned above?
c) any better way, or ??
is it possible to somehow make (using the output format template) for the console sink such a "lower profile" color?
You can just switch the outputTemplate based on the presence of the command-line flag:
bool verbose = false;
var template = verbose ?
"{Timestamp:HH:mm:ss} [{Level:u3}] {Message}{NewLine}{Exception}" :
"{Message}{NewLine}";
Log.Logger = new LoggerConfiguration()
.WriteTo.Console(outputTemplate: template,
theme: SystemConsoleTheme.Grayscale)
.CreateLogger();
See the theme argument supplied in the example for how to change coloring.

Video Inside Silhouette using kinect

I am using this git
I am getting error data/config.json does not exist or could not be read.
How do I create json file or load one?
The configuration json file is missing from the source code, however, checking out how the json is parsed in ConfigManager should allow you to create one from scratch.
Just looking at what the property names and types are in that class you can work out something like this:
{
"clips":[
{
"silhouette":"add your silhouette filename here",
"background":"add your background filename here",
"duration":0
}
],
"useKinect":true,
"useGpu":false,
"name":"Your Application Name here",
"resizeSilhouette":false,
"mirrorSilhouette":false,
"resizeSilouhette":false,
"overlayVideo":true,
"useActionClips":false,
"silhouettePadding":{
"top":5,
"right":5,
"bottom":5,
"left":5
},
"centerOfMass":true,
"showTime":true,
"smoothSilhouette":0,
"crossfade":0,
"silhouetteCache":{
"enabled":false,
"minFrames":3,
"maxFrames":10
},
"scale":{
"width":640,
"height":480
},
"osc":{
"enabled":false,
"serverPort":12000,
"clientAddress":"127.0.0.1",
"clientPort":12001,
"channels":0
},
"actions":{
"frequency":1,
"clips":[
"clipName1","clipName2"
]
}
}
If you save this as config.json in your sketch's data folder it should load.
However, bare in mind this may also crash as I've just placed some dummy placeholder data to give you an idea. Fill in the data you think you know what it should be for your project and figure out the rest as you go along.
Unfortunately the github project you decided to use isn't documented, so this means you will have to go through all the source code and understand it before you get to use it.

Resources