​Output DASH segments are longer than requested with google cloud transcoder - google-cloud-transcoder

This job sets 2s segments for the video and audio streams. The video total duration is 134s, so I would expect about 67 segments. However we see in the MPD manifest that there are 45 video segments, and 54 audio segments (for each audio track).
Is this the expected behavior? Our player does buffer more than 2s at once.
Why is there a different number of video and audio segments?
Job Config
{
"config":{
"inputs":[
{
"key":"input0",
"uri":"gs://inputfile.mp4"
}
],
"editList":[
{
"key":"atom0",
"inputs":[
"input0"
],
"endTimeOffset":"134.549s",
"startTimeOffset":"0s"
}
],
"elementaryStreams":[
{
"videoStream":{
"codec":"h264",
"profile":"high",
"preset":"veryfast",
"widthPixels":224,
"pixelFormat":"yuv420p",
"bitrateBps":500000,
"rateControlMode":"crf",
"crfLevel":24,
"vbvSizeBits":500000,
"vbvFullnessBits":450000,
"gopDuration":"3s",
"entropyCoder":"cabac",
"frameRate":0.1
},
"key":"thumbnail-lowfps-stream"
},
{
"videoStream":{
"codec":"h264",
"profile":"high",
"preset":"veryfast",
"widthPixels":224,
"pixelFormat":"yuv420p",
"bitrateBps":500000,
"rateControlMode":"crf",
"crfLevel":24,
"vbvSizeBits":500000,
"vbvFullnessBits":450000,
"gopDuration":"3s",
"entropyCoder":"cabac",
"frameRate":1
},
"key":"thumbnail-mediumfps-stream"
},
{
"videoStream":{
"codec":"h264",
"profile":"high",
"preset":"veryfast",
"widthPixels":224,
"pixelFormat":"yuv420p",
"bitrateBps":500000,
"rateControlMode":"crf",
"crfLevel":24,
"vbvSizeBits":500000,
"vbvFullnessBits":450000,
"gopDuration":"3s",
"entropyCoder":"cabac",
"frameRate":5
},
"key":"thumbnail-highfps-stream"
},
{
"videoStream":{
"codec":"h264",
"profile":"high",
"preset":"veryfast",
"widthPixels":224,
"pixelFormat":"yuv420p",
"bitrateBps":500000,
"rateControlMode":"crf",
"crfLevel":24,
"vbvSizeBits":500000,
"vbvFullnessBits":450000,
"gopDuration":"3s",
"entropyCoder":"cabac",
"frameRate":2.23
},
"key":"thumbnail-dynamicfps-stream"
},
{
"videoStream":{
"codec":"h264",
"profile":"high",
"preset":"veryfast",
"widthPixels":400,
"pixelFormat":"yuv420p",
"bitrateBps":500000,
"rateControlMode":"crf",
"crfLevel":24,
"vbvSizeBits":500000,
"vbvFullnessBits":450000,
"gopDuration":"3s",
"entropyCoder":"cabac",
"frameRate":8.919
},
"key":"preview-ld-stream"
},
{
"videoStream":{
"codec":"h264",
"profile":"high",
"preset":"veryfast",
"widthPixels":852,
"pixelFormat":"yuv420p",
"bitrateBps":500000,
"rateControlMode":"crf",
"crfLevel":24,
"vbvSizeBits":500000,
"vbvFullnessBits":450000,
"gopDuration":"3s",
"entropyCoder":"cabac",
"frameRate":30
},
"key":"preview-hd-stream"
},
{
"audioStream":{
"codec":"aac",
"bitrateBps":128000,
"channelCount":2,
"channelLayout":[
"fl",
"fr"
],
"mapping":[
{
"key":"atom0",
"channels":[
{
"inputs":[
{
"key":"input0",
"track":1
}
]
},
{
"inputs":[
{
"key":"input0",
"track":1,
"channel":1
}
]
}
]
}
],
"sampleRateHertz":48000
},
"key":"audio-stream-1"
},
{
"audioStream":{
"codec":"aac",
"bitrateBps":128000,
"channelCount":2,
"channelLayout":[
"fl",
"fr"
],
"mapping":[
{
"key":"atom0",
"channels":[
{
"inputs":[
{
"key":"input0",
"track":2
}
]
},
{
"inputs":[
{
"key":"input0",
"track":2,
"channel":1
}
]
}
]
}
],
"sampleRateHertz":48000
},
"key":"audio-stream-2"
},
{
"audioStream":{
"codec":"aac",
"bitrateBps":128000,
"channelCount":2,
"channelLayout":[
"fl",
"fr"
],
"mapping":[
{
"key":"atom0",
"channels":[
{
"inputs":[
{
"key":"input0",
"track":3
}
]
},
{
"inputs":[
{
"key":"input0",
"track":3,
"channel":1
}
]
}
]
}
],
"sampleRateHertz":48000
},
"key":"audio-stream-3"
},
{
"audioStream":{
"codec":"aac",
"bitrateBps":128000,
"channelCount":2,
"channelLayout":[
"fl",
"fr"
],
"mapping":[
{
"key":"atom0",
"channels":[
{
"inputs":[
{
"key":"input0",
"track":4
}
]
},
{
"inputs":[
{
"key":"input0",
"track":4,
"channel":1
}
]
}
]
}
],
"sampleRateHertz":48000
},
"key":"audio-stream-4"
}
],
"muxStreams":[
{
"key":"thumbnail-lowfps-mux",
"fileName":"small_low_fps.mp4",
"container":"mp4",
"elementaryStreams":[
"thumbnail-lowfps-stream"
]
},
{
"key":"thumbnail-mediumfps-mux",
"fileName":"small_mid_fps.mp4",
"container":"mp4",
"elementaryStreams":[
"thumbnail-mediumfps-stream"
]
},
{
"key":"thumbnail-highfps-mux",
"fileName":"small_high_fps.mp4",
"container":"mp4",
"elementaryStreams":[
"thumbnail-highfps-stream"
]
},
{
"key":"thumbnail-dynamicfps-mux",
"fileName":"small_dynamic_fps.mp4",
"container":"mp4",
"elementaryStreams":[
"thumbnail-dynamicfps-stream"
]
},
{
"key":"preview-ld-mux",
"fileName":"preview_seek.mp4",
"container":"mp4",
"elementaryStreams":[
"preview-ld-stream"
]
},
{
"key":"preview-hd-mux-dash",
"fileName":"preview-hd-mux-dash.m4s",
"container":"fmp4",
"elementaryStreams":[
"preview-hd-stream"
],
"segmentSettings":{
"segmentDuration":"2s"
}
},
{
"key":"audio-stream-1-mux",
"fileName":"audio-stream-1-mux.m4s",
"container":"fmp4",
"elementaryStreams":[
"audio-stream-1"
],
"segmentSettings":{
"segmentDuration":"2s"
}
},
{
"key":"audio-stream-2-mux",
"fileName":"audio-stream-2-mux.m4s",
"container":"fmp4",
"elementaryStreams":[
"audio-stream-2"
],
"segmentSettings":{
"segmentDuration":"2s"
}
},
{
"key":"audio-stream-3-mux",
"fileName":"audio-stream-3-mux.m4s",
"container":"fmp4",
"elementaryStreams":[
"audio-stream-3"
],
"segmentSettings":{
"segmentDuration":"2s"
}
},
{
"key":"audio-stream-4-mux",
"fileName":"audio-stream-4-mux.m4s",
"container":"fmp4",
"elementaryStreams":[
"audio-stream-4"
],
"segmentSettings":{
"segmentDuration":"2s"
}
}
],
"manifests":[
{
"fileName":"preview_main.mpd",
"type":"DASH",
"muxStreams":[
"preview-hd-mux-dash",
"audio-stream-1-mux",
"audio-stream-2-mux",
"audio-stream-3-mux",
"audio-stream-4-mux"
]
}
],
"output":{
"uri":"gs://output-bucket"
},
"spriteSheets":[
{
"format":"jpeg",
"filePrefix":"small_mid_fps_sprite-",
"spriteWidthPixels":224,
"spriteHeightPixels":126,
"columnCount":1,
"rowCount":1,
"startTimeOffset":"0s",
"interval":"1s"
}
]
},
}

The reason this happen is due to gopDuration==3s, and segmentDuration==2s.
gopDuration has to be <= segmentDuration, and, at the same time, segmentDuration has to be divisible by gopDuration.
Once you set gopDuration==2s, you should get what you want.

Related

Is it possible set the "Use row x as headers" option for a chart using Google Sheets API?

I'm currently trying to build charts with and set the legend labels correctly, but I can't seem to find a way to do this using the API.
Seems like it is possible with Apps Script, but I don't want to do this workaround unless there is no other way.
Here's a picture of what I want
In this case, please modify the value of headerCount from 0 to 1. You can find this property in the property of basicChart. When UpdateChartSpecRequest is used, the sample request body is as follows.
{
"requests": [
{
"updateChartSpec": {
"chartId": ###, <--- Please set your chart ID.
"spec": {
"title": "Chart 0",
"basicChart": {
"chartType": "COLUMN",
"axis": [
{
"position": "BOTTOM_AXIS",
"title": "condition",
"format": {
"fontFamily": "Roboto"
},
"viewWindowOptions": {}
},
{
"position": "LEFT_AXIS",
"viewWindowOptions": {}
}
],
"domains": [
{
"domain": {
"sourceRange": {
"sources": [
{
"startRowIndex": 3,
"endRowIndex": 7,
"startColumnIndex": 0,
"endColumnIndex": 1
}
]
}
}
}
],
"series": [
{
"series": {
"sourceRange": {
"sources": [
{
"startRowIndex": 3,
"endRowIndex": 7,
"startColumnIndex": 1,
"endColumnIndex": 2
}
]
}
},
"targetAxis": "LEFT_AXIS",
"dataLabel": {
"type": "NONE",
"textFormat": {
"fontFamily": "Roboto"
}
}
},
{
"series": {
"sourceRange": {
"sources": [
{
"startRowIndex": 3,
"endRowIndex": 7,
"startColumnIndex": 2,
"endColumnIndex": 3
}
]
}
},
"targetAxis": "LEFT_AXIS",
"dataLabel": {
"type": "NONE",
"textFormat": {
"fontFamily": "Roboto"
}
}
}
],
"headerCount": 1 <--- This is important modification point.
},
"hiddenDimensionStrategy": "SKIP_HIDDEN_ROWS_AND_COLUMNS",
"titleTextFormat": {
"fontFamily": "Roboto"
},
"fontName": "Roboto"
}
}
}
]
}
Reference:
UpdateChartSpecRequest

Container is connecting default cluster when trying to setup new ECS Cluster

I am using following cloud formation script to create a new ECS cluster
*{
"AWSTemplateFormatVersion":"2010-09-09",
"Parameters":{
"KeyName":{
"Type":"AWS::EC2::KeyPair::KeyName",
"Description":"Name of an existing EC2 KeyPair to enable SSH access to the ECS instances."
},
"VpcId":{
"Type":"AWS::EC2::VPC::Id",
"Description":"Select a VPC that allows instances to access the Internet."
},
"SubnetId":{
"Type":"List<AWS::EC2::Subnet::Id>",
"Description":"Select at two subnets in your selected VPC."
},
"DesiredCapacity":{
"Type":"Number",
"Default":"1",
"Description":"Number of instances to launch in your ECS cluster."
},
"MaxSize":{
"Type":"Number",
"Default":"1",
"Description":"Maximum number of instances that can be launched in your ECS cluster."
},
"InstanceType":{
"Description":"EC2 instance type",
"Type":"String",
"Default":"t2.micro",
"AllowedValues":[
"t2.micro",
"t2.small",
"t2.medium",
"t2.large",
"m3.medium",
"m3.large",
"m3.xlarge",
"m3.2xlarge",
"m4.large",
"m4.xlarge",
"m4.2xlarge",
"m4.4xlarge",
"m4.10xlarge",
"c4.large",
"c4.xlarge",
"c4.2xlarge",
"c4.4xlarge",
"c4.8xlarge",
"c3.large",
"c3.xlarge",
"c3.2xlarge",
"c3.4xlarge",
"c3.8xlarge",
"r3.large",
"r3.xlarge",
"r3.2xlarge",
"r3.4xlarge",
"r3.8xlarge",
"i2.xlarge",
"i2.2xlarge",
"i2.4xlarge",
"i2.8xlarge"
],
"ConstraintDescription":"Please choose a valid instance type."
}
},
"Mappings":{
"AWSRegionToAMI":{
"us-east-1":{
"AMIID":"ami-0c65e6401a50512c5"
}
}
},
"Resources":{
"ECSCluster":{
"Type":"AWS::ECS::Cluster"
},
"EcsSecurityGroup":{
"Type":"AWS::EC2::SecurityGroup",
"Properties":{
"GroupDescription":"ECS Security Group",
"VpcId":{
"Ref":"VpcId"
}
}
},
"EcsSecurityGroupHTTPinbound":{
"Type":"AWS::EC2::SecurityGroupIngress",
"Properties":{
"GroupId":{
"Ref":"EcsSecurityGroup"
},
"IpProtocol":"tcp",
"FromPort":"80",
"ToPort":"80",
"CidrIp":"0.0.0.0/0"
}
},
"EcsSecurityGroupSSHinbound":{
"Type":"AWS::EC2::SecurityGroupIngress",
"Properties":{
"GroupId":{
"Ref":"EcsSecurityGroup"
},
"IpProtocol":"tcp",
"FromPort":"22",
"ToPort":"22",
"CidrIp":"0.0.0.0/0"
}
},
"EcsSecurityGroupALBports":{
"Type":"AWS::EC2::SecurityGroupIngress",
"Properties":{
"GroupId":{
"Ref":"EcsSecurityGroup"
},
"IpProtocol":"tcp",
"FromPort":"31000",
"ToPort":"61000",
"SourceSecurityGroupId":{
"Ref":"EcsSecurityGroup"
}
}
},
"CloudwatchLogsGroup":{
"Type":"AWS::Logs::LogGroup",
"Properties":{
"LogGroupName":{
"Fn::Join":[
"-",
[
"ECSLogGroup",
{
"Ref":"AWS::StackName"
}
]
]
},
"RetentionInDays":14
}
},
"taskdefinition":{
"Type":"AWS::ECS::TaskDefinition",
"Properties":{
"Family":{
"Fn::Join":[
"",
[
{
"Ref":"AWS::StackName"
},
"-ecs-demo-app"
]
]
},
"ContainerDefinitions":[
{
"Name":"simple-app",
"Cpu":"10",
"Essential":"true",
"Image":"httpd:2.4",
"Memory":"300",
"LogConfiguration":{
"LogDriver":"awslogs",
"Options":{
"awslogs-group":{
"Ref":"CloudwatchLogsGroup"
},
"awslogs-region":{
"Ref":"AWS::Region"
},
"awslogs-stream-prefix":"ecs-demo-app"
}
},
"MountPoints":[
{
"ContainerPath":"/usr/local/apache2/htdocs",
"SourceVolume":"my-vol"
}
],
"PortMappings":[
{
"ContainerPort":80
}
]
},
{
"Name":"busybox",
"Cpu":10,
"Command":[
"/bin/sh -c \"while true; do echo '<html> <head> <title>Amazon ECS Sample App</title> <style>body {margin-top: 40px; background-color: #333;} </style> </head><body> <div style=color:white;text-align:center> <h1>Amazon ECS Sample App</h1> <h2>Congratulations!</h2> <p>Your application is now running on a container in Amazon ECS.</p>' > top; /bin/date > date ; echo '</div></body></html>' > bottom; cat top date bottom > /usr/local/apache2/htdocs/index.html ; sleep 1; done\""
],
"EntryPoint":[
"sh",
"-c"
],
"Essential":false,
"Image":"busybox",
"Memory":200,
"LogConfiguration":{
"LogDriver":"awslogs",
"Options":{
"awslogs-group":{
"Ref":"CloudwatchLogsGroup"
},
"awslogs-region":{
"Ref":"AWS::Region"
},
"awslogs-stream-prefix":"ecs-demo-app"
}
},
"VolumesFrom":[
{
"SourceContainer":"simple-app"
}
]
}
],
"Volumes":[
{
"Name":"my-vol"
}
]
}
},
"ECSALB":{
"Type":"AWS::ElasticLoadBalancingV2::LoadBalancer",
"Properties":{
"Name":"ECSALB",
"Scheme":"internet-facing",
"LoadBalancerAttributes":[
{
"Key":"idle_timeout.timeout_seconds",
"Value":"30"
}
],
"Subnets":{
"Ref":"SubnetId"
},
"SecurityGroups":[
{
"Ref":"EcsSecurityGroup"
}
]
}
},
"ALBListener":{
"Type":"AWS::ElasticLoadBalancingV2::Listener",
"DependsOn":"ECSServiceRole",
"Properties":{
"DefaultActions":[
{
"Type":"forward",
"TargetGroupArn":{
"Ref":"ECSTG"
}
}
],
"LoadBalancerArn":{
"Ref":"ECSALB"
},
"Port":"80",
"Protocol":"HTTP"
}
},
"ECSALBListenerRule":{
"Type":"AWS::ElasticLoadBalancingV2::ListenerRule",
"DependsOn":"ALBListener",
"Properties":{
"Actions":[
{
"Type":"forward",
"TargetGroupArn":{
"Ref":"ECSTG"
}
}
],
"Conditions":[
{
"Field":"path-pattern",
"Values":[
"/"
]
}
],
"ListenerArn":{
"Ref":"ALBListener"
},
"Priority":1
}
},
"ECSTG":{
"Type":"AWS::ElasticLoadBalancingV2::TargetGroup",
"DependsOn":"ECSALB",
"Properties":{
"HealthCheckIntervalSeconds":10,
"HealthCheckPath":"/",
"HealthCheckProtocol":"HTTP",
"HealthCheckTimeoutSeconds":5,
"HealthyThresholdCount":2,
"Name":"ECSTG",
"Port":80,
"Protocol":"HTTP",
"UnhealthyThresholdCount":2,
"VpcId":{
"Ref":"VpcId"
}
}
},
"ECSAutoScalingGroup":{
"Type":"AWS::AutoScaling::AutoScalingGroup",
"Properties":{
"VPCZoneIdentifier":{
"Ref":"SubnetId"
},
"LaunchConfigurationName":{
"Ref":"ContainerInstances"
},
"MinSize":"1",
"MaxSize":{
"Ref":"MaxSize"
},
"DesiredCapacity":{
"Ref":"DesiredCapacity"
}
},
"CreationPolicy":{
"ResourceSignal":{
"Timeout":"PT300M"
}
},
"UpdatePolicy":{
"AutoScalingReplacingUpdate":{
"WillReplace":"true"
}
}
},
"ContainerInstances":{
"Type":"AWS::AutoScaling::LaunchConfiguration",
"Properties":{
"ImageId":{
"Fn::FindInMap":[
"AWSRegionToAMI",
{
"Ref":"AWS::Region"
},
"AMIID"
]
},
"SecurityGroups":[
{
"Ref":"EcsSecurityGroup"
}
],
"InstanceType":{
"Ref":"InstanceType"
},
"IamInstanceProfile":{
"Ref":"EC2InstanceProfile"
},
"KeyName":{
"Ref":"KeyName"
},
"UserData":{
"Fn::Base64": {
"Fn::Join": [
"",
[
"#!/bin/bash\n",
"# Install the files and packages from the metadata\n",
"sudo /opt/aws/bin/cfn-init -v ",
" --stack ",
{
"Ref": "AWS::StackName"
},
" --resource ContainerInstances ",
" --region ",
{
"Ref": "AWS::Region"
},
"\n",
"sudo yum -y update \n",
"# Signal the status from cfn-init\n",
"sudo /opt/aws/bin/cfn-signal -e $? ",
" --stack ",
{
"Ref": "AWS::StackName"
},
" --resource ECSAutoScalingGroup ",
" --region ",
{
"Ref": "AWS::Region"
},
"\n"
]
]
}
}
}
},
"service":{
"Type":"AWS::ECS::Service",
"DependsOn":"ALBListener",
"Properties":{
"Cluster":{
"Ref":"ECSCluster"
},
"DesiredCount":"1",
"LoadBalancers":[
{
"ContainerName":"simple-app",
"ContainerPort":"80",
"TargetGroupArn":{
"Ref":"ECSTG"
}
}
],
"Role":{
"Ref":"ECSServiceRole"
},
"TaskDefinition":{
"Ref":"taskdefinition"
}
}
},
"ECSServiceRole":{
"Type":"AWS::IAM::Role",
"Properties":{
"AssumeRolePolicyDocument":{
"Statement":[
{
"Effect":"Allow",
"Principal":{
"Service":[
"ecs.amazonaws.com"
]
},
"Action":[
"sts:AssumeRole"
]
}
]
},
"Path":"/",
"Policies":[
{
"PolicyName":"ecs-service",
"PolicyDocument":{
"Statement":[
{
"Effect":"Allow",
"Action":[
"elasticloadbalancing:DeregisterInstancesFromLoadBalancer",
"elasticloadbalancing:DeregisterTargets",
"elasticloadbalancing:Describe*",
"elasticloadbalancing:RegisterInstancesWithLoadBalancer",
"elasticloadbalancing:RegisterTargets",
"ec2:Describe*",
"ec2:AuthorizeSecurityGroupIngress"
],
"Resource":"*"
}
]
}
}
]
}
},
"ServiceScalingTarget":{
"Type":"AWS::ApplicationAutoScaling::ScalableTarget",
"DependsOn":"service",
"Properties":{
"MaxCapacity":2,
"MinCapacity":1,
"ResourceId":{
"Fn::Join":[
"",
[
"service/",
{
"Ref":"ECSCluster"
},
"/",
{
"Fn::GetAtt":[
"service",
"Name"
]
}
]
]
},
"RoleARN":{
"Fn::GetAtt":[
"AutoscalingRole",
"Arn"
]
},
"ScalableDimension":"ecs:service:DesiredCount",
"ServiceNamespace":"ecs"
}
},
"ServiceScalingPolicy":{
"Type":"AWS::ApplicationAutoScaling::ScalingPolicy",
"Properties":{
"PolicyName":"AStepPolicy",
"PolicyType":"StepScaling",
"ScalingTargetId":{
"Ref":"ServiceScalingTarget"
},
"StepScalingPolicyConfiguration":{
"AdjustmentType":"PercentChangeInCapacity",
"Cooldown":60,
"MetricAggregationType":"Average",
"StepAdjustments":[
{
"MetricIntervalLowerBound":0,
"ScalingAdjustment":200
}
]
}
}
},
"ALB500sAlarmScaleUp":{
"Type":"AWS::CloudWatch::Alarm",
"Properties":{
"EvaluationPeriods":"1",
"Statistic":"Average",
"Threshold":"10",
"AlarmDescription":"Alarm if our ALB generates too many HTTP 500s.",
"Period":"60",
"AlarmActions":[
{
"Ref":"ServiceScalingPolicy"
}
],
"Namespace":"AWS/ApplicationELB",
"Dimensions":[
{
"Name":"LoadBalancer",
"Value":{
"Fn::GetAtt" : [
"ECSALB",
"LoadBalancerFullName"
]
}
}
],
"ComparisonOperator":"GreaterThanThreshold",
"MetricName":"HTTPCode_ELB_5XX_Count"
}
},
"EC2Role":{
"Type":"AWS::IAM::Role",
"Properties":{
"AssumeRolePolicyDocument":{
"Statement":[
{
"Effect":"Allow",
"Principal":{
"Service":[
"ec2.amazonaws.com"
]
},
"Action":[
"sts:AssumeRole"
]
}
]
},
"Path":"/",
"Policies":[
{
"PolicyName":"ecs-service",
"PolicyDocument":{
"Statement":[
{
"Effect":"Allow",
"Action":[
"ec2:DescribeTags",
"ecs:CreateCluster",
"ecs:DeregisterContainerInstance",
"ecs:DiscoverPollEndpoint",
"ecs:Poll",
"ecs:RegisterContainerInstance",
"ecs:StartTelemetrySession",
"ecs:UpdateContainerInstancesState",
"ecs:Submit*",
"ecr:GetAuthorizationToken",
"ecr:BatchCheckLayerAvailability",
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource":"*"
}
]
}
}
]
}
},
"AutoscalingRole":{
"Type":"AWS::IAM::Role",
"Properties":{
"AssumeRolePolicyDocument":{
"Statement":[
{
"Effect":"Allow",
"Principal":{
"Service":[
"application-autoscaling.amazonaws.com"
]
},
"Action":[
"sts:AssumeRole"
]
}
]
},
"Path":"/",
"Policies":[
{
"PolicyName":"service-autoscaling",
"PolicyDocument":{
"Statement":[
{
"Effect":"Allow",
"Action":[
"application-autoscaling:*",
"cloudwatch:DescribeAlarms",
"cloudwatch:PutMetricAlarm",
"ecs:DescribeServices",
"ecs:UpdateService"
],
"Resource":"*"
}
]
}
}
]
}
},
"EC2InstanceProfile":{
"Type":"AWS::IAM::InstanceProfile",
"Properties":{
"Path":"/",
"Roles":[
{
"Ref":"EC2Role"
}
]
}
}
},
"Outputs":{
"ecsservice":{
"Value":{
"Ref":"service"
}
},
"ecscluster":{
"Value":{
"Ref":"ECSCluster"
}
},
"ECSALB":{
"Description":"Your ALB DNS URL",
"Value":{
"Fn::Join":[
"",
[
{
"Fn::GetAtt":[
"ECSALB",
"DNSName"
]
}
]
]
}
},
"taskdef":{
"Value":{
"Ref":"taskdefinition"
}
}
}
}*
It got stuck in creating the service resource.
When I try to debug this, I found in the log on EC2 instance for ecs-agent docker:
Registration completed successfully. I am running as 'arn:aws:ecs:us-east-1:504254995642:container-instance/22a5c138-61b0-454f-b64e-f49a76fc6cbe' in cluster 'default'
Please can you suggest how can I configure it to 'my-cluster'
You'll need to add ECS_CLUSTER=my_cluster to /etc/ecs/ecs.config in userData script. That way you're telling ecs-agent to register itself to the correct ECS cluster.
From here.
Here is an example of doing this.
Hope it helps.

Display series labels at the end of each line in Highcharts Editor

I am a beginner in Highcharts and I am trying to achieve what has been explained in the following case using the Highcharts Editor:
Highcharts Line Chart, display series name at the end of line series
I don't know if the same can be achieved by just using the Editor's interface but if custom code needs to be used, I can do that in the Custom Code tab of the Editor.
I tried inputting in the Custom Code section of the Highcharts Editor the code written by jlbriggs but nothing happens.
Is it possible to get a basic explanation on how to achieve what I want?
Below is the HTML code I took from the graph I created in Highcharts Editor.
<div id="highcharts-825789cd-edd9-4d9e-aba4-e3a80fa42369"></div>
<script>
(function() {
var files = ["https://code.highcharts.com/stock/highstock.js", "https://code.highcharts.com/highcharts-more.js", "https://code.highcharts.com/highcharts-3d.js", "https://code.highcharts.com/modules/data.js", "https://code.highcharts.com/modules/exporting.js", "https://code.highcharts.com/modules/funnel.js", "https://code.highcharts.com/modules/annotations.js", "https://code.highcharts.com/modules/solid-gauge.js"],
loaded = 0;
if (typeof window["HighchartsEditor"] === "undefined") {
window.HighchartsEditor = {
ondone: [cl],
hasWrapped: false,
hasLoaded: false
};
include(files[0]);
} else {
if (window.HighchartsEditor.hasLoaded) {
cl();
} else {
window.HighchartsEditor.ondone.push(cl);
}
}
function isScriptAlreadyIncluded(src) {
var scripts = document.getElementsByTagName("script");
for (var i = 0; i < scripts.length; i++) {
if (scripts[i].hasAttribute("src")) {
if ((scripts[i].getAttribute("src") || "").indexOf(src) >= 0 || (scripts[i].getAttribute("src") === "http://code.highcharts.com/highcharts.js" && src === "https://code.highcharts.com/stock/highstock.js")) {
return true;
}
}
}
return false;
}
function check() {
if (loaded === files.length) {
for (var i = 0; i < window.HighchartsEditor.ondone.length; i++) {
try {
window.HighchartsEditor.ondone[i]();
} catch (e) {
console.error(e);
}
}
window.HighchartsEditor.hasLoaded = true;
}
}
function include(script) {
function next() {
++loaded;
if (loaded < files.length) {
include(files[loaded]);
}
check();
}
if (isScriptAlreadyIncluded(script)) {
return next();
}
var sc = document.createElement("script");
sc.src = script;
sc.type = "text/javascript";
sc.onload = function() {
next();
};
document.head.appendChild(sc);
}
function each(a, fn) {
if (typeof a.forEach !== "undefined") {
a.forEach(fn);
} else {
for (var i = 0; i < a.length; i++) {
if (fn) {
fn(a[i]);
}
}
}
}
var inc = {},
incl = [];
each(document.querySelectorAll("script"), function(t) {
inc[t.src.substr(0, t.src.indexOf("?"))] = 1;
});
function cl() {
if (typeof window["Highcharts"] !== "undefined") {
var options = {
"title": {
"text": "One year, five year and 10 year survival estimates for the 21 most common cancers in England, 1971"
},
"subtitle": {
"text": "Survival estimates in 1971 (%)"
},
"exporting": {},
"chart": {
"type": "line",
"parallelAxes": {
"labels": {
"enabled": true
},
"alignTicks": true,
"endOnTick": true,
"max": 4,
"maxRange": 4,
"minorGridLineWidth": 0,
"gridLineWidth": -1
},
"inverted": false,
"height": 872,
"alignTicks": true,
"showAxes": false,
"ignoreHiddenSeries": true
},
"series": [{
"name": "Oesophagus",
"turboThreshold": 0,
"marker": {
"enabled": true
},
"type": "line",
"colorByPoint": false,
"selected": true,
"showInNavigator": true,
"dataLabels": {
"enabled": false
},
"label": {
"onArea": true,
"enabled": true
},
"allowPointSelect": true,
"xAxis": 0,
"yAxis": 0
}, {
"name": "Stomach",
"turboThreshold": 0
}, {
"name": "Colon",
"turboThreshold": 0
}, {
"name": "Rectum",
"turboThreshold": 0
}, {
"name": "Pancreas",
"turboThreshold": 0,
"marker": {
"enabled": true
},
"type": "line"
}, {
"name": "Larynx",
"turboThreshold": 0
}, {
"name": "Lung",
"turboThreshold": 0
}, {
"name": "Melanoma of skin",
"turboThreshold": 0
}, {
"name": "Breast",
"turboThreshold": 0
}, {
"name": "Cervix",
"turboThreshold": 0
}, {
"name": "Uterus",
"turboThreshold": 0
}, {
"name": "Ovary",
"turboThreshold": 0
}, {
"name": "Prostate",
"turboThreshold": 0,
"marker": {
"enabled": true
},
"colorByPoint": false
}, {
"name": "Testis",
"turboThreshold": 0
}, {
"name": "Kidney",
"turboThreshold": 0
}, {
"name": "Bladder",
"turboThreshold": 0
}, {
"name": "Brain",
"turboThreshold": 0
}, {
"name": "Hodgkin's disease",
"turboThreshold": 0
}, {
"name": "Non-Hodgkin lymphoma",
"turboThreshold": 0
}, {
"name": "Multiple myeloma",
"turboThreshold": 0
}, {
"name": "Leukaemia",
"turboThreshold": 0
}, {
"name": "Other cancers",
"turboThreshold": 0,
"label": {
"connectorAllowed": true
}
}],
"plotOptions": {
"series": {
"dataLabels": {
"enabled": false
}
}
},
"data": {
"csv": "\"Year\";\"Oesophagus\";\"Stomach\";\"Colon\";\"Rectum\";\"Pancreas\";\"Larynx\";\"Lung\";\"Melanoma of skin\";\"Breast\";\"Cervix\";\"Uterus\";\"Ovary\";\"Prostate\";\"Testis\";\"Kidney\";\"Bladder\";\"Brain\";\"Hodgkin's disease\";\"Non-Hodgkin lymphoma\";\"Multiple myeloma\";\"Leukaemia\";\"Other cancers\"\n\"1-year\";14.7;15.3;42.6;54.1;10.2;16;16.3;74.5;74;75.6;43.7;66.1;83.3;44.9;45.4;62.8;17.6;73.9;49.4;36.8;35.4;57.3\n\"5-year\";4;5.2;25.3;23.6;2.4;4.6;4.8;40.5;51.3;59;20.5;36.9;70.5;28.5;28.9;40.9;6.6;54.2;29.3;12.1;13.1;40.4\n\"10-year\";3.3;4;23;19.1;1.3;3.1;3.2;34.9;46;55.5;17.9;25.1;69.2;23;23;33.7;5;45.2;21.7;6.8;6.6;36.9",
"googleSpreadsheetKey": false,
"googleSpreadsheetWorksheet": false
},
"legend": {
"floating": false,
"enabled": false,
"verticalAlign": "bottom",
"align": "center",
"layout": "horizontal"
},
"pane": {
"background": []
},
"responsive": {
"rules": []
},
"colorAxis": {
"plotLines": [{
"label": {
"useHTML": false,
"text": "'series'",
"x": 5,
"y": 5,
"verticalAlign": "'middle'",
"textAlign": "'left'"
}
}],
"plotBands": [{}],
"labels": {
"x": 3,
"y": 2
}
},
"tooltip": {
"shared": true,
"enabled": true
},
"rangeSelector": {
"enabled": false,
"floating": false
},
"credits": {
"enabled": false
},
"xAxis": [{
"type": "category",
"labels": {
"x": 0,
"zIndex": 7
},
"opposite": true
}],
"yAxis": [{
"title": {
"text": ""
},
"labels": {
"format": "{hide}"
},
"type": "linear"
}],
"accessibility": {
"describeSingleSeries": false,
"enabled": true
}
};
new Highcharts.Chart("highcharts-825789cd-edd9-4d9e-aba4-e3a80fa42369", options);
}
}
})();
</script>
I just need the names of each series to be displayed at the end of each line rather than in the legend.
In the "Custom code" section you need to merge your custom options with the options from the editor. There should be an example of how to do that. In essense:
Highcharts.merge(true, options, {
// custom code
});
For example, you could use Highcharts.merge in the following way to achieve this:
Highcharts.merge(true, options, {
plotOptions: {
series: {
dataLabels: {
enabled: true,
formatter: function () {
// if last point
if(this.point === this.series.data[this.series.data.length-1]) {
return this.series.name;
}
}
}
}
}
});
See this Highcharts Cloud example of it in use.

Highcharts/highstock set yAxis Min and Max with Scroll

I have a stacked column highstock chart with positive and negative stacks and a horizontal scrollbar. I am trying to have the yAxis with min and max values according to the max data and min data so I've setup those values (after calculating them) in highstock's json.
However, the length of the names of the users on the xAxis are overriding these max values, is there a way around that?
Here's my js fiddle: http://jsfiddle.net/fj6d2/3931/
As the code is too large to be posted here, here's the configuration without all the data:
Highcharts.chart('container', {
"chart":{
"type":"column"
},
"title":{
"text":""
},
"xAxis":{
"min":0,
"max":31,
"categories":[
"Xxx Xxxx",
"Xxx Xxxx",
"Xxx Xxxx",
"Xxx Xxxxx",
],
"labels":{
"style":{
"font-size":"12px"
},
"useHTML":true,
"events":{
}
}
},
"scrollbar":{
"enabled":true,
"barBackgroundColor":"gray",
"barBorderRadius":7,
"barBorderWidth":0,
"buttonBackgroundColor":"gray",
"buttonBorderWidth":0,
"buttonArrowColor":"yellow",
"buttonBorderRadius":7,
"rifleColor":"yellow",
"trackBackgroundColor":"white",
"trackBorderWidth":1,
"trackBorderColor":"silver",
"trackBorderRadius":7
},
"yAxis":{
"title":{
"text":"Time (hh:mm)"
},
"tickInterval":600,
"labels":{
},
"gridLineWidth":0,
"plotLines":[
{
"value":0,
"width":1,
"color":"#000",
"zIndex":4
}
],
"tickmarkPlacement":"on",
"max":45336,
"min":-21443
},
"plotOptions":{
"column":{
"stacking":"normal",
"events":{
}
}
},
"credits":{
"enabled":false
},
"tooltip":{
"shared":true,
"crosshairs":true
},
"legend":{
"align":"right",
"verticalAlign":"top",
"itemStyle":{
"display":"none"
},
"title":{
"text":"Click a colour"
}
},
"series":[
{
"name":"On Task Teacher Recommended",
"data":[
487,
13512,
10064,
2664,
],
"color":"#86E067",
"events":{
},
"point":{
"events":false
},
"customEvents":{
"series":{
},
"point":{
}
}
},
{
"name":"On Task Student Discovered",
"data":[
1276,
5495,
1307,
3369,
],
"color":"#5CB5E5",
"events":{
},
"point":{
"events":false
},
"customEvents":{
"series":{
},
"point":{
}
}
},
{
"name":"Uncategorised",
"data":[
944,
12202,
2920,
4643,
],
"color":"#F98157",
"events":{
},
"point":{
"events":false
},
"customEvents":{
"series":{
},
"point":{
}
}
},
{
"name":"Off Task",
"data":[
-126,
-686,
-1998,
-927,
],
"color":"#E3454D",
"events":{
},
"point":{
"events":false
},
"customEvents":{
"series":{
},
"point":{
}
}
}
]
});
you can truncate long name (xAxis) of highcharts using function
function truncString(str, max, add){
add = add || '...';
return (typeof str === 'string' && str.length > max ? str.substring(0,max)+add : str);
};
And call this function in formatter
"labels":{
"formatter": function() {
return truncString(this.value,8,'...')
},
"style":{
"font-size":"12px"
},
"useHTML":true,
"events":{
}
}
Fiddle demo

What is the RootElement of this Content

I'm trying to use the TRESTResponseDataSetAdapter.
Every combination that I've tried for the JSON RootElement property fails
You can view the content by running this in your browser:
https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=Demo&count=1000
{
"contacts":[
{
"addedAt":1405347851360,
"vid":154835,
"canonical-vid":154835,
"merged-vids":[
],
"portal-id":62515,
"is-contact":true,
"profile-token":"AO_T-mMn77ArlMSBCTdpOp0rf0qYYooZ7bHB6ehvufx9uNoV0Pyuiq1wq-A83BQmzFVFVC45T8S6tXhkq_7fcDi5Wzne7VXydwTvrKIViisZNBjWhUjJ8OiXhXW0owESlE2QCh2_rZsy",
"profile-url":"https://app.hubspot.com/contacts/62515/lists/public/contact/_AO_T-mMn77ArlMSBCTdpOp0rf0qYYooZ7bHB6ehvufx9uNoV0Pyuiq1wq-A83BQmzFVFVC45T8S6tXhkq_7fcDi5Wzne7VXydwTvrKIViisZNBjWhUjJ8OiXhXW0owESlE2QCh2_rZsy/",
"properties":{
"firstname":{
"value":"HubSpot"
},
"lastmodifieddate":{
"value":"1429569233340"
},
"lastname":{
"value":"Test"
}
},
"form-submissions":[
{
"conversion-id":"b18f9fd8-b8d3-49e5-898a-ac301fac93e9",
"timestamp":1405347851180,
"form-id":"b844ad5e-32bd-41e1-b0e6-ed990c5f3d1b",
"portal-id":62515,
"page-url":"http://demo.hubapi.com/your-stunning-headline-30",
"page-title":"Your stunning headline!",
"page-id":"324527",
"title":"My New Form",
"meta-data":[
]
}
],
"identity-profiles":[
{
"vid":154835,
"saved-at-timestamp":1405347851237,
"deleted-changed-timestamp":0,
"identities":[
{
"type":"EMAIL",
"value":"test#hubspot.com",
"timestamp":1405347851180
},
{
"type":"LEAD_GUID",
"value":"c8f20860-d3d6-4b57-b092-86a07cebdcbc",
"timestamp":1405347851237
}
]
}
],
"merge-audits":[
]
},
{
"addedAt":1390569372731,
"vid":196181,
"canonical-vid":196181,
"merged-vids":[
],
"portal-id":62515,
"is-contact":true,
"profile-token":"AO_T-mNWKZQBRv0UiQpPnG-WPBgVlfYwFgdTyJW3sU9frlA4esRYMOtMpo4OQMh736HGvJpuDLAuJexFXkyrIPu7eK-hxFYwGoqefbbP1cQeh6B0mRPE-iU1dhYRhRJsWyroaToFvFuo",
"profile-url":"https://app.hubspot.com/contacts/62515/lists/public/contact/_AO_T-mNWKZQBRv0UiQpPnG-WPBgVlfYwFgdTyJW3sU9frlA4esRYMOtMpo4OQMh736HGvJpuDLAuJexFXkyrIPu7eK-hxFYwGoqefbbP1cQeh6B0mRPE-iU1dhYRhRJsWyroaToFvFuo/",
"properties":{
"firstname":{
"value":"Charles"
},
"lastmodifieddate":{
"value":"1429569231725"
},
"company":{
"value":""
},
"lastname":{
"value":"Gowland"
}
},
"form-submissions":[
],
"identity-profiles":[
{
"vid":196181,
"saved-at-timestamp":1390569372649,
"deleted-changed-timestamp":0,
"identities":[
{
"type":"EMAIL",
"value":"clg#gburnette.com",
"timestamp":1390568711002
},
{
"type":"LEAD_GUID",
"value":"dca0d8a2-fa9c-4ca6-b5ef-c1bfb4a0bed4",
"timestamp":1390569372636
}
]
}
],
"merge-audits":[
]
},
{
"addedAt":1390569372834,
"vid":196182,
"canonical-vid":196182,
"merged-vids":[
],
"portal-id":62515,
"is-contact":true,
"profile-token":"AO_T-mPTJ_EIS2780cJONDGKv5bmchukJnQ37QmmSc-lPJacEyzXo8piybhaAhQzT0HBXxq0QYXFU_4wN5ewYsclTt8WE3KAxx6neusNNYGr8aEiy-s6izAG-CCehTdomM5Pai4YOKue",
"profile-url":"https://app.hubspot.com/contacts/62515/lists/public/contact/_AO_T-mPTJ_EIS2780cJONDGKv5bmchukJnQ37QmmSc-lPJacEyzXo8piybhaAhQzT0HBXxq0QYXFU_4wN5ewYsclTt8WE3KAxx6neusNNYGr8aEiy-s6izAG-CCehTdomM5Pai4YOKue/",
"properties":{
"firstname":{
"value":"Curtis"
},
"lastmodifieddate":{
"value":"1429569238098"
},
"company":{
"value":""
},
"lastname":{
"value":"Romig"
}
},
"form-submissions":[
],
"identity-profiles":[
{
"vid":196182,
"saved-at-timestamp":1390569372699,
"deleted-changed-timestamp":0,
"identities":[
{
"type":"EMAIL",
"value":"curtis.romig#bryancave.com",
"timestamp":1390568725415
},
{
"type":"LEAD_GUID",
"value":"e18dc184-0238-48f1-a8a2-4476733f50d3",
"timestamp":1390569372641
}
]
}
],
"merge-audits":[
]
},
{
"addedAt":1390569372757,
"vid":196183,
"canonical-vid":196183,
"merged-vids":[
],
"portal-id":62515,
"is-contact":true,
"profile-token":"AO_T-mOq49asR9pF4P9paqXhVApLjs9CXDFqCFs4BL7Y5z7TRYRoSC9i8cXxGOdXZqC-3D1doXT5G-pmAG283AFo0BYY3D-1AV2VhwIlVZ3t1KF-6G7DBQw80lRqBjPbJhtLnY7U6rd-",
"profile-url":"https://app.hubspot.com/contacts/62515/lists/public/contact/_AO_T-mOq49asR9pF4P9paqXhVApLjs9CXDFqCFs4BL7Y5z7TRYRoSC9i8cXxGOdXZqC-3D1doXT5G-pmAG283AFo0BYY3D-1AV2VhwIlVZ3t1KF-6G7DBQw80lRqBjPbJhtLnY7U6rd-/",
"properties":{
"firstname":{
"value":"Eugene"
},
"lastmodifieddate":{
"value":"1429569256338"
},
"company":{
"value":""
},
"lastname":{
"value":"Klibanoff"
}
},
"form-submissions":[
],
"identity-profiles":[
{
"vid":196183,
"saved-at-timestamp":1390569372682,
"deleted-changed-timestamp":0,
"identities":[
{
"type":"EMAIL",
"value":"eklibanoff#incomm.com",
"timestamp":1390568722786
},
{
"type":"LEAD_GUID",
"value":"276f1a0f-ce8f-4069-9b7a-405f9e14971a",
"timestamp":1390569372674
}
]
}
],
"merge-audits":[
]
},
{
"addedAt":1390569372800,
"vid":196184,
"canonical-vid":196184,
"merged-vids":[
],
"portal-id":62515,
"is-contact":true,
"profile-token":"AO_T-mMay6vd3gbNXXOGGn7WYa4332kjWEY6hYvggd98z-MYeHHaXL8BqAHSmsGQ1VVuN9_JOUPlqQ5ZC4e0-fNjOqj-yNp23nsqldKBYY0WF-m5pgnOGEwXEV2eLNVJmFffQ0U3SXXL",
"profile-url":"https://app.hubspot.com/contacts/62515/lists/public/contact/_AO_T-mMay6vd3gbNXXOGGn7WYa4332kjWEY6hYvggd98z-MYeHHaXL8BqAHSmsGQ1VVuN9_JOUPlqQ5ZC4e0-fNjOqj-yNp23nsqldKBYY0WF-m5pgnOGEwXEV2eLNVJmFffQ0U3SXXL/",
"properties":{
"firstname":{
"value":"James C. & Brenda L."
},
"lastmodifieddate":{
"value":"1429569255451"
},
"company":{
"value":""
},
"lastname":{
"value":"Kellling"
}
},
"form-submissions":[
],
"identity-profiles":[
{
"vid":196184,
"saved-at-timestamp":1390569372744,
"deleted-changed-timestamp":0,
"identities":[
{
"type":"EMAIL",
"value":"jameskelling#bellsouth.net",
"timestamp":1390568911277
},
{
"type":"LEAD_GUID",
"value":"4b92ccc6-d777-4e3e-90d9-bc4722329c16",
"timestamp":1390569372738
}
]
}
],
"merge-audits":[
]
}
],
"has-more":true,
"vid-offset":196184
}
I'm trying to build a ClientDataSet that includes Company, FirstName, LastName and EMAIL
Can someone please view the content and identify the correct RootElement for me ?
There is no plug-and-play way for this kind of data structure to map inside a TClientDataSet.
The mapping can be done by TRESTResponseDataSetAdapter on an array of objects like this
[
{
"firstname": "John",
"lastname": "Doe",
"email": "john#doe.com"
},
{
"firstname": "Jane",
"lastname": "Doe",
"email": "jane#doe.com"
}
]
or even nested
{
"contacts": [
{
"firstname": "John",
"lastname": "Doe",
"email": "john#doe.com"
},
{
"firstname": "Jane",
"lastname": "Doe",
"email": "jane#doe.com"
}
]
}
when you set the RootElement property to contacts.
But not with this kind of nested structure you are getting from your REST API.
You have to know the structure and map that by hand

Resources