Add Bootstrap Actions while creating EMR cluster from AWS Step Functions - amazon-emr

I'm creating EMR cluster from Step Functions using below code,
"spinning_emr_cluster": {
"Type": "Task",
"Resource": "arn:aws:states:::elasticmapreduce:createCluster.sync",
"Parameters": {
"Name": "CombineFiles",
"VisibleToAllUsers": true,
"ReleaseLabel": "emr-5.29.0",
"Applications": [
{
"Name": "Spark"
}
],
"ServiceRole": "EMR_DefaultRole",
"JobFlowRole": "EMR_EC2_DefaultRole",
"LogUri": "s3://awsmssqltos3/emr_logs/",
"Instances": {
"KeepJobFlowAliveWhenNoSteps": true,
"InstanceFleets": [
{
"Name": "Master",
"InstanceFleetType": "MASTER",
"TargetOnDemandCapacity": 1,
"InstanceTypeConfigs": [
{
"InstanceType": "m1.large"
}
]
},
{
"Name": "Slave",
"InstanceFleetType": "CORE",
"TargetOnDemandCapacity": 1,
"InstanceTypeConfigs": [
{
"InstanceType": "m1.large"
}
]
}
]
}
},
"ResultPath": "$.CreateClusterResult",
"Next": "lambda"
I want to add bootstrap actions while creating the cluster from AWS Step Functions. I have tried searching online but could not find any syntax for that.

"BootstrapActions": [
{
"Name": "CustomBootStrapAction",
"ScriptBootstrapAction": {
"Path": "",
"Args": []
}
}
]
Please Add above code inside Parameters Block.

Related

Run dynamic stored procedure from azure logic app

I want to run multiple stored procedures from logic app for Azure SQL database. I want names of the stored procedure to be calculated based on a variable name.
I have a variable with values (API_test1_SP1, API_test2_SP1, API_test3_SP1).
In a for loop, I want to run these stored procedures API_test1, API_test2 and API_test3.
I want to remove _SPI from the variable names and run the stored procedures (API_test1, API_test2, API_test3) for Azure SQL database.
I tried following expression without luck
#{concat(API_,slice(#{variables('variable_name')},1,lastIndexOf('_')))}
Is it possible to run stored procedure like this in logic app?
You can use the below expression to achieve your requirement.
first(split(variables('Array')?[iterationIndexes('Until')],'_SP1'))
To reproduce the issue, I have used the below flow in my logic app.
RESULTS:
Below is the codeview of my logic app
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Initialize_variable_-_array": {
"inputs": {
"variables": [
{
"name": "Array",
"type": "array",
"value": [
"API_test1_SP1",
"API_test2_SP1",
"API_test3_SP1"
]
}
]
},
"runAfter": {},
"type": "InitializeVariable"
},
"Initialize_variable_-_loop": {
"inputs": {
"variables": [
{
"name": "loop",
"type": "integer",
"value": 0
}
]
},
"runAfter": {
"Initialize_variable_-_array": [
"Succeeded"
]
},
"type": "InitializeVariable"
},
"Until": {
"actions": {
"Compose": {
"inputs": "#first(split(variables('Array')?[iterationIndexes('Until')],'_SP1'))",
"runAfter": {},
"type": "Compose"
},
"Increment_variable": {
"inputs": {
"name": "loop",
"value": 1
},
"runAfter": {
"Compose": [
"Succeeded"
]
},
"type": "IncrementVariable"
}
},
"expression": "#equals(variables('loop'), length(variables('Array')))",
"limit": {
"count": 60,
"timeout": "PT1H"
},
"runAfter": {
"Initialize_variable_-_loop": [
"Succeeded"
]
},
"type": "Until"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {}
}

NLog webservice target how do I specify json layout in appsettings.json

I can't seem to find an example. I want to Use NLog as a webservice, but when I add it I am seeing HTTP POST with a body of {}. How in appsettings.json do I specify the json layout?
"NLog": {
"targets": {
"allfile":{
"type":"File",
"fileName":"/tmp/nlog-all-${shortdate}.log",
"layout":"${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}"
},
"dabomb": {
"type": "webservice",
"url": "http://localhost:9990/api/foo/",
"protocol": "JsonPost",
????? WHAT GOES HERE ??????
}
},
"rules": [
{
"logger": "*",
"minLevel": "Debug",
"writeTo": "dabomb"
}
]
You can try this:
"dabomb": {
"type": "webservice",
"url": "http://localhost:9990/api/foo/",
"protocol": "JsonPost",
"parameters": [
{
"Name": "",
"Layout": {
"type": "JsonLayout",
"Attributes": [
{
"name": "level",
"layout": "${level}"
},
{
"name": "message",
"layout": "${message}"
} ]
}
} ]
}
See also: https://github.com/NLog/NLog/wiki/WebService-target

GA4 data api - (not set) in custom dimensions

We are currently using GA4 data API and faced the issue when custom dimensions returns value "(not set)".
We were using the following article to set custom dimension for the session count, but we still receiving "(not set)" values.
Example of request:
{
"dateRanges": [
{
"startDate": "2021-09-01",
"endDate": "2021-09-05"
}
],
"offset": 0,
"limit": 100,
"dimensionFilter": {
"filter": {
"fieldName": "eventName",
"stringFilter": {
"matchType": 1,
"value": "screen_view",
"caseSensitive": true
}
}
},
"dimensions": [
{
"name": "customUser:applicationID"
},
{
"name": "customEvent:ga_session_number"
},
{
"name": "dateHour"
},
{
"name": "platform"
},
{
"name": "sessionSource"
},
{
"name": "sessionMedium"
},
{
"name": "sessionCampaignName"
},
{
"name": "deviceCategory"
}
],
"metrics": [
{
"name": "userEngagementDuration"
}
]
}
Does anybody have any idea why it may happen?

Azure Container Groups and Later Swapping One of the Containers in the Container Group

When you deploy an azure container group ("Microsoft.ContainerInstance/containerGroups"), can you replace just one of the containers at a later time?
Or does the creation of the container_group have to have all the containers at the time of creation (of the container group) ?
https://learn.microsoft.com/en-us/azure/container-instances/container-instances-multi-container-group
"resources": [
{
"name": "[parameters('resourceGroupName')]",
"type": "Microsoft.ContainerInstance/containerGroups",
"apiVersion": "2018-06-01",
"location": "[resourceGroup().location]",
"properties": {
"containers": [
{
"name": "[parameters('loggingContainerName')]",
"properties": {
"image": "[parameters('loggingContainerImage')]",
"resources": {
"requests": {
"cpu": 1,
"memoryInGb": 1
}
},
"volumeMounts": [
{
"name": "[parameters('volumeName')]",
"mountPath": "/aci/logs/"
}
],
"ports": [
{
"port": 8080
}
]
}
},
{
"name": "[parameters('jobGeneratorContainerName')]",
"properties": {
"image": "[parameters('jobGeneratorContainerImage')]",
"resources": {
"requests": {
"cpu": 1,
"memoryInGb": 1
}
},
"ports": [
{
"port": 80
}
],
"volumeMounts": [
{
"name": "[parameters('volumeName')]",
"mountPath": "/aci/logs/"
}
],
"environmentVariables": [
{
"name": "ServiceBusConnectionString",
"value": "[parameters('serviceBusConnectionStringSend')]"
},
{
"name": "LoggingServiceUrl",
"value": "[parameters('loggingServiceUrl')]"
}
]
}
},
{
"name": "[parameters('jobProcessingContainerName')]",
"properties": {
"image": "[parameters('jobProcessingContainerImage')]",
"resources": {
"requests": {
"cpu": 1,
"memoryInGb": 1
}
},
"ports": [
{
"port": 8000
}
],
"environmentVariables": [
{
"name": "ServiceBusConnectionString",
"value": "[parameters('serviceBusConnectionStringListen')]"
},
{
"name": "LoggingServiceUrl",
"value": "[parameters('loggingServiceUrl')]"
}
]
}
}
],
"osType": "Linux",
"ipAddress": {
"type": "Public",
"ports": [
{
"protocol": "tcp",
"port": "80"
},
{
"protocol": "TCP",
"port": 443
}
],
"dnsNameLabel": "[uniqueString( resourceGroup().id )]"
},
As I know, what you said is right. The top level in Azure container instances is container group. No matter one or more than one container instances you want to create in a container group, you should create it or them in one time.
If the container group is created, you cannot change it, such as adding containers or changing container images. If you really want, you just can create a new one.
By the way, the multi-container group only support for Linux containers.

Intellij IDEA, control page up, page down scroll size

I am not satisfied with the scrolling behaviour in intellij for page up, page down. It doesn't feel right. It always feels as if I get out of the scope.
Is it possible to adjust the scroll size of page up, page down? Perhaps to half a page or similar.
I had taken #yole's answer and implemented all of the actions he had described in a separate plugin:
There is no way to control this through the settings. What you can do is write a plugin that performs scrolling in the way that you prefer. It's fairly easy: all you need to do is copy the existing
PageUpAction/PageDownAction classes and the methods they call
(EditorActionUtil.moveCaretPageUp/Down) to scroll by as much as you want.
This plugin implements new actions "Partial Page Up" and "Partial Page Down" which allow one to scroll a configurable size of screen definable in the usual IDEA settings dialog.
There's an installable version of the plugin in official JetBrains repository.
There is no way to control this through the settings. What you can do is write a plugin that performs scrolling in the way that you prefer. It's fairly easy: all you need to do is copy the existing PageUpAction/PageDownAction classes and the methods they call (EditorActionUtil.moveCaretPageUp/Down) to scroll by as much as you want.
Since many are inquiring about this, for mac users this can be controlled globally instead by instead scrolling on page up/down using karabiner application and adding the following complex rule:
{
"description": "mmm.karabiner.page.up.down.to.scroll",
"manipulators": [
{
"conditions": [
{
"bundle_identifiers": [
"^net.java.openjdk.cmd",
"^com.jetbrains.intellij"
],
"type": "frontmost_application_if"
}
],
"from": {
"key_code": "page_up"
},
"to": [
{
"mouse_key": {
"vertical_wheel": -51
}
}
],
"to_delayed_action": {
"to_if_invoked": [
{
"pointing_button": "button1"
}
]
},
"type": "basic"
},
{
"conditions": [
{
"bundle_identifiers": [
"^net.java.openjdk.cmd",
"^com.jetbrains.intellij"
],
"type": "frontmost_application_unless"
}
],
"from": {
"key_code": "page_up"
},
"to": [
{
"mouse_key": {
"vertical_wheel": -51
}
}
],
"type": "basic"
},
{
"conditions": [
{
"bundle_identifiers": [
"^net.java.openjdk.cmd",
"^com.jetbrains.intellij"
],
"type": "frontmost_application_if"
}
],
"from": {
"key_code": "up_arrow",
"modifiers": {
"mandatory": [
"fn"
]
}
},
"to": [
{
"mouse_key": {
"vertical_wheel": -51
}
}
],
"to_delayed_action": {
"to_if_invoked": [
{
"pointing_button": "button1"
}
]
},
"type": "basic"
},
{
"conditions": [
{
"bundle_identifiers": [
"^net.java.openjdk.cmd",
"^com.jetbrains.intellij"
],
"type": "frontmost_application_unless"
}
],
"from": {
"key_code": "up_arrow",
"modifiers": {
"mandatory": [
"fn"
]
}
},
"to": [
{
"mouse_key": {
"vertical_wheel": -51
}
}
],
"type": "basic"
},
{
"conditions": [
{
"bundle_identifiers": [
"^net.java.openjdk.cmd",
"^com.jetbrains.intellij"
],
"type": "frontmost_application_if"
}
],
"from": {
"key_code": "page_down"
},
"to": [
{
"mouse_key": {
"vertical_wheel": 51
}
}
],
"to_delayed_action": {
"to_if_invoked": [
{
"pointing_button": "button1"
}
]
},
"type": "basic"
},
{
"conditions": [
{
"bundle_identifiers": [
"^net.java.openjdk.cmd",
"^com.jetbrains.intellij"
],
"type": "frontmost_application_unless"
}
],
"from": {
"key_code": "page_down"
},
"to": [
{
"mouse_key": {
"vertical_wheel": 51
}
}
],
"type": "basic"
},
{
"conditions": [
{
"bundle_identifiers": [
"^net.java.openjdk.cmd",
"^com.jetbrains.intellij"
],
"type": "frontmost_application_if"
}
],
"from": {
"key_code": "down_arrow",
"modifiers": {
"mandatory": [
"fn"
]
}
},
"to": [
{
"mouse_key": {
"vertical_wheel": 51
}
}
],
"to_delayed_action": {
"to_if_invoked": [
{
"pointing_button": "button1"
}
]
},
"type": "basic"
},
{
"conditions": [
{
"bundle_identifiers": [
"^net.java.openjdk.cmd",
"^com.jetbrains.intellij"
],
"type": "frontmost_application_unless"
}
],
"from": {
"key_code": "down_arrow",
"modifiers": {
"mandatory": [
"fn"
]
}
},
"to": [
{
"mouse_key": {
"vertical_wheel": 51
}
}
],
"type": "basic"
}
]
},
Also do note, to get smooth scrolling, consider down loading Mos application and adjust the preferences if desired.
https://mos.caldis.me/
This might have other consequences on your Mac so you might need to have to adjust other things since your page_up/down is no longer a page_up/down but mouse scrolls instead.