Name relationship link between two different types in Apache Atlas - apache-atlas

I am trying to name relationship link (by using attributeDefs) between two different types. The relationship is now registered in Atlas and definition fetch results as below:
{
"category": "RELATIONSHIP",
"guid": "9b1059c3-8707-46db-ae3c-e8d1b4ef6333",
"createdBy": "admin",
"updatedBy": "admin",
"createTime": 1625233869809,
"updateTime": 1625496519772,
"version": 6,
"name": "field_assignment",
"description": "someDescription.",
"typeVersion": "1.0",
"attributeDefs": [
{
"name": "LinkInformation",
"typeName": "string",
"isOptional": true,
"cardinality": "SINGLE",
"valuesMinCount": 0,
"valuesMaxCount": 1,
"isUnique": false,
"isIndexable": false,
"includeInNotification": false,
"searchWeight": -1
}
],
"relationshipCategory": "ASSOCIATION",
"propagateTags": "NONE",
"endDef1": {
"type": "custom_dataset",
"name": "fields",
"isContainer": false,
"cardinality": "SET",
"isLegacyAttribute": false
},
"endDef2": {
"type": "custom_field",
"name": "datasets",
"isContainer": false,
"cardinality": "SET",
"isLegacyAttribute": false
}
}
Now, I am trying to create a relationship between two types while defining an Entity for either type like
{
"entities": [
{
"typeName": "custom_field",
"createdBy": "admin",
"guid": -1000,
"attributes": {
"name": "type",
"datasets": [
{
"guid": "-200",
"typeName": "custom_dataset"
}
]
},
"classifications": [],
}
],
"referredEntities": {
"-200": {
"guid": "-200",
"typeName": "custome_dataset",
"relationshipAttributes" : {"LinkInformation": "key"},
"attributes": {
"qualifiedName": "test"
}
}
}
}
Through, while executing this, I don't see any error and entities are created but LinkInformation is null by simply doing a search by GUID for entities.
...
"relationshipAttributes": {
"typeName": "field_assignment",
"attributes": {
"LinkInformation": null
}
}
...
I am not able to find a good documentation anywhere for this. Can anyone help?

Atlas relationship between existing entities can be created either using entity GUIDs or uniqueAttributes in end1 and end2 which can be qualifiedName or any other unique attribute .
Please do note that top level typeName is the relationship def typeName while typeName inside end1 and end2 is entity typeName.
In case of relationship between hive_table and hive_db the relationship def typeName is: hive_table_db
So, if you want to create a relationship between hive_table and hive_db, the request would be:
POST: /api/atlas/v2/relationship
{
"typeName": "hive_table_db",
"end1": {
"typeName": "hive_table",
"uniqueAttributes": {
"qualifiedName": "db.table#cluster"
}
},
"end2": {
"typeName": "hive_db",
"uniqueAttributes": {
"qualifiedName": "db#cluster"
}
}
}
For predefined Atlas types you can find the relationship typeName from its definition inside relationshipAttributeDefs field
GET: /api/atlas/v2/types/typedef/name/hive_db
Which gives the following response:
{
"category": "ENTITY",
"guid": "9b1059c3-8707-46db-ae3c-e8d1b4ef6333",
"createdBy": "root",
"updatedBy": "root",
"createTime": 1548175553859,
"updateTime": 1548175822249,
"version": 2,
"name": "hive_db",
"description": "hive_db",
"typeVersion": "1.2",
"serviceType": "hive",
"attributeDefs": [
{
"name": "clusterName",
"typeName": "string",
"isOptional": false,
"cardinality": "SINGLE",
"valuesMinCount": 1,
"valuesMaxCount": 1,
"isUnique": false,
"isIndexable": true,
"includeInNotification": true,
"searchWeight": -1
},
{
"name": "location",
"typeName": "string",
"isOptional": true,
"cardinality": "SINGLE",
"valuesMinCount": 0,
"valuesMaxCount": 1,
"isUnique": false,
"isIndexable": false,
"includeInNotification": false,
"searchWeight": -1
},
{
"name": "parameters",
"typeName": "map<string,string>",
"isOptional": true,
"cardinality": "SINGLE",
"valuesMinCount": 0,
"valuesMaxCount": 1,
"isUnique": false,
"isIndexable": false,
"includeInNotification": false,
"searchWeight": -1
},
{
"name": "ownerType",
"typeName": "hive_principal_type",
"isOptional": true,
"cardinality": "SINGLE",
"valuesMinCount": 0,
"valuesMaxCount": 1,
"isUnique": false,
"isIndexable": false,
"includeInNotification": false,
"searchWeight": -1
}
],
"superTypes": [
"Asset"
],
"subTypes": [],
"relationshipAttributeDefs": [
{
"name": "tables",
"typeName": "array<hive_table>",
"isOptional": true,
"cardinality": "SET",
"valuesMinCount": -1,
"valuesMaxCount": -1,
"isUnique": false,
"isIndexable": false,
"includeInNotification": false,
"searchWeight": -1,
"constraints": [
{
"type": "ownedRef"
}
],
"relationshipTypeName": "hive_table_db",
"isLegacyAttribute": false
},
{
"name": "ddlQueries",
"typeName": "array<hive_db_ddl>",
"isOptional": true,
"cardinality": "SET",
"valuesMinCount": -1,
"valuesMaxCount": -1,
"isUnique": false,
"isIndexable": false,
"includeInNotification": false,
"searchWeight": -1,
"constraints": [
{
"type": "ownedRef"
}
],
"relationshipTypeName": "hive_db_ddl_queries",
"isLegacyAttribute": false
},
{
"name": "meanings",
"typeName": "array<AtlasGlossaryTerm>",
"isOptional": true,
"cardinality": "SET",
"valuesMinCount": -1,
"valuesMaxCount": -1,
"isUnique": false,
"isIndexable": false,
"includeInNotification": false,
"searchWeight": -1,
"relationshipTypeName": "AtlasGlossarySemanticAssignment",
"isLegacyAttribute": false
}
]
}
Further, you need to make sure the typeName in end1 and end2 is as per the relationship def, which you can check in type definition:
GET: /api/atlas/v2/types/typedef/name/hive_table_db
{
"category": "RELATIONSHIP",
"guid": "9b1059c3-8707-46db-ae3c-e8d1b4ef6333",
"createdBy": "root",
"updatedBy": "root",
"createTime": 1548175553894,
"updateTime": 1548175553894,
"version": 1,
"name": "hive_table_db",
"description": "hive_table_db",
"typeVersion": "1.0",
"serviceType": "hive",
"attributeDefs": [],
"relationshipCategory": "COMPOSITION",
"propagateTags": "NONE",
"endDef1": {
"type": "hive_table",
"name": "db",
"isContainer": false,
"cardinality": "SINGLE",
"isLegacyAttribute": true
},
"endDef2": {
"type": "hive_db",
"name": "tables",
"isContainer": true,
"cardinality": "SET",
"isLegacyAttribute": false
}
}

Related

Grafana 8 | Notifications Alert

We did an upgrade to our Loki-stack from version:2.1.0 to version 2.4.1, After the upgrade Grafana Alert Rules are not working previously we were running version: 6.7 of Grafana, and now we running version:8.0. In the dashboard am getting the below error.
Error:
Checking the logs on Grafana pod am getting the below error.
t=2022-05-11T13:16:12+0000 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=user1 method=GET path=/api/prometheus/grafana/api/v1/rules status=404 remote_addr=159.12.0.4 time_ms=2 size=29 referer="https://digisc.dev.company.com/internal/grafana/d/k8s_views_global/kubernetes-views-global-version-8-grafana?orgId=1&refresh=30s"
t=2022-05-11T13:30:57+0000 lvl=info msg="Request Completed" logger=context userId=1 orgId=1 uname=user1 method=GET path=/api/alertmanager/grafana/config/api/v1/alerts status=404 remote_addr=159.12.0.4 time_ms=9 size=29 referer=https://digisc.dev.campany.com/internal/grafana/alerting/notifications
In the browser console am getting below error.
https://digisc.dev.company.com/internal/grafana/api/ruler/1/api/v1/rules 500
We used helm to release our infrastructure changes.
Below is one of the alerts we used::
{
"alert": {
"alertRuleTags": {},
"conditions": [
{
"evaluator": {
"params": [
15
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"params": [
"C",
"5m",
"now"
]
},
"reducer": {
"params": [],
"type": "last"
},
"type": "query"
}
],
"executionErrorState": "alerting",
"for": "5m",
"frequency": "1m",
"handler": 1,
"name": "Cluster CPU Capacity alert",
"noDataState": "ok",
"notifications": []
},
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus",
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 5,
"w": 6,
"x": 6,
"y": 9
},
"hiddenSeries": false,
"id": 10,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {
"dataLinks": []
},
"percentage": false,
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "sum(kube_node_status_capacity_cpu_cores)",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "allocatable",
"refId": "A"
},
{
"expr": "sum(kube_node_status_allocatable_cpu_cores)",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "capacity",
"refId": "B"
},
{
"expr": "sum(kube_pod_container_resource_requests_cpu_cores)",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "requested",
"refId": "C"
}
],
"thresholds": [
{
"colorMode": "critical",
"fill": true,
"line": true,
"op": "gt",
"value": 15
}
],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Cluster CPU Capacity",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"decimals": null,
"format": "none",
"label": "cores",
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
}
Can you please assist if you are familiar with this error maybe we missed a configuration during the upgrade?
We used below helm chart for Loki::
https://github.com/grafana/helm-charts/tree/main/charts/loki-stack

deploy web apps /create Stages by api to run new deployments

It’ possible to create a deploment stage by Azure DevOps API? We want to create a new stage and want to deploy a web app on the webserver. What is the best approach to release a new web app including the configuration of iis by azure devops API?
Kind Regards,
Dominik
If you mean creating release definition with stages and specific tasks, then you can call the Definitions - Create REST API.
For example to add a stage with the IIS Web App Deploy task:
POST : https://vsrm.dev.azure.com/{organization}/{project}/_apis/release/definitions?api-version=6.0
Request Body: (Of course, you need to replace the parameters accordingly. You can also capture the Request Body(Payload) by pressing F12 when creating a release definition from the UI)
{
"id": 0,
"name": "RESTAPI-WEB",
"source": 2,
"comment": "",
"createdOn": "2022-04-20T08:36:03.598Z",
"createdBy": null,
"modifiedBy": null,
"modifiedOn": "2022-04-20T08:36:03.598Z",
"environments": [
{
"id": -3,
"name": "Stage 1",
"rank": 1,
"variables": {},
"variableGroups": [],
"preDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": true,
"isNotificationOn": false,
"id": 0
}
],
"approvalOptions": {
"executionOrder": 1
}
},
"deployStep": {
"tasks": [],
"id": 0
},
"postDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": true,
"isNotificationOn": false,
"id": 0
}
],
"approvalOptions": {
"executionOrder": 2
}
},
"deployPhases": [
{
"deploymentInput": {
"parallelExecution": {
"parallelExecutionType": 0
},
"agentSpecification": null,
"skipArtifactsDownload": false,
"artifactsDownloadInput": {},
"queueId": 158,
"demands": [],
"enableAccessToken": false,
"timeoutInMinutes": 0,
"jobCancelTimeoutInMinutes": 1,
"condition": "succeeded()",
"overrideInputs": {},
"dependencies": []
},
"rank": 1,
"phaseType": 1,
"name": "Agent job",
"refName": null,
"workflowTasks": [
{
"name": "Deploy IIS Website/App: ",
"refName": null,
"enabled": true,
"timeoutInMinutes": 0,
"inputs": {
"WebSiteName": "TestSite",
"VirtualApplication": "",
"Package": "$(System.DefaultWorkingDirectory)\\**\\*.zip",
"SetParametersFile": "",
"RemoveAdditionalFilesFlag": "true",
"ExcludeFilesFromAppDataFlag": "true",
"TakeAppOfflineFlag": "false",
"AdditionalArguments": "",
"XmlTransformation": "false",
"XmlVariableSubstitution": "false",
"JSONFiles": ""
},
"taskId": "1b467810-6725-4b6d-accd-886174c09bba",
"version": "0.*",
"definitionType": "task",
"alwaysRun": false,
"continueOnError": false,
"overrideInputs": {},
"condition": "succeeded()",
"environment": {},
"retryCountOnTaskFailure": 0
}
],
"phaseInputs": {}
}
],
"runOptions": {},
"environmentOptions": {
"emailNotificationType": "OnlyOnFailure",
"emailRecipients": "release.environment.owner;release.creator",
"skipArtifactsDownload": false,
"timeoutInMinutes": 0,
"enableAccessToken": false,
"publishDeploymentStatus": true,
"badgeEnabled": false,
"autoLinkWorkItems": false,
"pullRequestDeploymentEnabled": false
},
"demands": [],
"conditions": [
{
"conditionType": 1,
"name": "ReleaseStarted",
"value": ""
}
],
"executionPolicy": {
"concurrencyCount": 1,
"queueDepthCount": 0
},
"schedules": [],
"properties": {
"LinkBoardsWorkItems": false,
"BoardsEnvironmentType": "unmapped"
},
"preDeploymentGates": {
"id": 0,
"gatesOptions": null,
"gates": []
},
"postDeploymentGates": {
"id": 0,
"gatesOptions": null,
"gates": []
},
"retentionPolicy": {
"daysToKeep": 30,
"releasesToKeep": 3,
"retainBuild": true
},
"processParameters": {}
}
],
"artifacts": [
{
"type": "Build",
"definitionReference": {
"IsMultiDefinitionType": {
"name": "False",
"id": "False"
},
"project": {
"name": "AzureFunction",
"id": "4da2f07a-ac7b-43a0-b764-459af8a4d9df"
},
"repository": {
"name": "",
"id": ""
},
"definitions": {
"name": "",
"id": ""
},
"definition": {
"name": "AzureFunctions_CI",
"id": "172"
},
"defaultVersionType": {
"name": "Latest",
"id": "latestType"
},
"defaultVersionBranch": {
"name": "",
"id": ""
},
"defaultVersionTags": {
"name": "",
"id": ""
},
"defaultVersionSpecific": {
"name": "",
"id": ""
}
},
"alias": "_AzureFunctions_CI",
"isPrimary": true,
"sourceId": "",
"isRetained": false
}
],
"variables": {},
"variableGroups": [],
"triggers": [],
"lastRelease": null,
"tags": [],
"path": "\\",
"properties": {
"DefinitionCreationSource": "ReleaseNew",
"IntegrateJiraWorkItems": "false",
"IntegrateBoardsWorkItems": false
},
"releaseNameFormat": "Release-$(rev:r)",
"description": ""
}
To deploy the webapp, please refer to Deploy your Web Deploy package to IIS servers using WinRM and Deploy an Azure Web App for details.

Commit Status not working with Continuous Deployment Trigger in Azure Release via API

We have an Azure Repository which triggers a Release-Pipeline every time something is pushed to the main branch.
When a Release is triggered it shows its status (succeeded) on the right side in the commits in Azure Repos like on the following Picture:
It even shows which stage is already promoted etc. which is awesome. This all works fine when configuring the Release Pipeline Manually with the following CD-Trigger Configuration:
Even when exporting the Pipeline JSON file and reimporting it everything works as expected.
However, when creating the Release with the exact same Settings via API i don't see the Status of the Release. The trigger itself works as expected but the status in the commits is simply not there:
Does someone know which exact Setting in the Release-Pipeline.json is responsible for this status?
Here are some parts of the json body I send via API which might be missing something?
Edit: A few more information needed i guess. I use a cli-tool to create the body and send the api request. The values are templated.
The template gets its values either from previous api calls or from user inputs. Here is the complete template. I created it based on the manually configured relase-pipeline JSON (Which works fine and shows the status i want).
{
"name": "{{.BuildProjectName}}/{{.BuildServiceName}}",
"path": "\\",
"isDeleted": false,
"source": "restApi",
"releaseNameFormat": "{{.BuildServiceName}}-$(rev:r)",
"properties": {
"DefinitionCreationSource": {
"$type": "System.String",
"$value": "ReleaseNew"
},
"IntegrateBoardsWorkItems": {
"$type": "System.String",
"$value": "False"
},
"IntegrateJiraWorkItems": {
"$type": "System.String",
"$value": "false"
}
},
"artifacts": [
{
"sourceId": "{{.BuildProjectID}}:{{.BuildRepoID}}",
"type": "Git",
"alias": "BuildRepo",
"definitionReference": {
"branches": {
"id": "{{.BuildRepoDefaultBranch}}",
"name": "{{.BuildRepoDefaultBranch}}"
},
"checkoutNestedSubmodules": {
"id": "True",
"name": "Any nested submodules within"
},
"defaultVersionType": {
"id": "latestFromBranchType",
"name": "Latest from the default branch"
},
"definition": {
"id": "{{.BuildRepoID}}",
"name": "{{.BuildServiceName}}"
},
"project": {
"id": "{{.BuildProjectID}}",
"name": "{{.BuildProjectName}}"
}
},
"isPrimary": true,
"isRetained": false
},
{
"type": "Git",
"alias": "FluxDeployScript",
"definitionReference": {
"branches": {
"id": "master",
"name": "master"
},
"checkoutNestedSubmodules": {
"id": "True",
"name": "Any nested submodules within"
},
"defaultVersionType": {
"id": "latestFromBranchType",
"name": "Latest from the default branch"
},
"definition": {
"id": "black-washed",
"name": "azure-pipeline-templates"
},
"project": {
"id": "black-washed",
"name": "Operations"
}
},
"isRetained": false
},
{
"type": "Build",
"alias": "BuildPipeline",
"definitionReference": {
"defaultVersionType": {
"id": "latestType",
"name": "Latest"
},
"definition": {
"id": "{{.BuildPipelineID}}",
"name": "{{.BuildServiceName}}"
},
"IsMultiDefinitionType": {
"id": "False",
"name": "False"
},
"project": {
"id": "{{.BuildProjectID}}",
"name": "{{.BuildProjectName}}"
}
},
"isRetained": false
}
],
"environments": [
{
"name": "dev",
"rank": 1,
"conditions": [
{
"name": "ReleaseStarted",
"conditionType": 1,
"value": ""
}
],
"deployPhases": [
{
"rank": 1,
"phaseType": 1,
"name": "Agent job",
"refName": null,
"deploymentInput": {
"queueId": "{{.QueueID}}",
"agentSpecification": {
"identifier": "ubuntu-20.04"
}
},
"workflowTasks": [
{
"environment": {},
"taskId": "2a6ca863-f2ce-4f4d-8bcb-15e64608ec4b",
"version": "1.*",
"name": "Download flux creds",
"refName": "fluxCreds",
"enabled": true,
"alwaysRun": false,
"continueOnError": false,
"timeoutInMinutes": 0,
"definitionType": "task",
"overrideInputs": {},
"condition": "succeeded()",
"inputs": {
"secureFile": "black-washed",
"retryCount": "8",
"socketTimeout": ""
}
},
{
"environment": {
"USER_EMAIL": "{{.ApproverMail}}",
"ENVIRONMENT": "$(Release.EnvironmentName)",
"DESCRIPTION": "$(Release.ReleaseDescription)",
"URL": "$(Release.ReleaseWebURL)",
"PROJECT": "{{.BuildProjectName}}",
"CONTAINER": "{{.BuildServiceName}}",
"TAG": "$(Release.Artifacts.BuildPipeline.BuildNumber)",
"REPOSITORY": "finodigital.azurecr.io",
"WORKLOAD_TYPE": "deployment",
"NAMESPACE": "{{.BuildProjectName}}",
"WORKLOAD_NAME": "{{.BuildProjectName}}-{{.BuildServiceName}}",
"USER_NAME": "{{.ApproverName}}",
"FLUX_CREDS": "$(fluxCreds.secureFilePath)"
},
"taskId": "6c731c3c-3c68-459a-a5c9-bde6e6595b5b",
"version": "3.*",
"name": "Bash Script",
"refName": "",
"enabled": true,
"alwaysRun": false,
"continueOnError": false,
"timeoutInMinutes": 0,
"definitionType": "task",
"overrideInputs": {},
"condition": "succeeded()",
"inputs": {
"targetType": "filePath",
"filePath": "$(System.DefaultWorkingDirectory)/FluxDeployScript/flux-release.sh",
"arguments": "",
"workingDirectory": "",
"failOnStderr": "false",
"noProfile": "true",
"noRc": "true"
}
}
]
}
],
"retentionPolicy": {
"daysToKeep": 30,
"releasesToKeep": 3,
"retainBuild": true
},
"preDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": true,
"isNotificationOn": false
}
],
"approvalOptions": {
"requiredApproverCount": null,
"releaseCreatorCanBeApprover": false,
"autoTriggeredAndPreviousEnvironmentApprovedCanBeSkipped": false,
"enforceIdentityRevalidation": false,
"timeoutInMinutes": 0,
"executionOrder": 1
}
},
"postDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": true,
"isNotificationOn": false
}
],
"approvalOptions": {
"requiredApproverCount": null,
"releaseCreatorCanBeApprover": false,
"autoTriggeredAndPreviousEnvironmentApprovedCanBeSkipped": false,
"enforceIdentityRevalidation": false,
"timeoutInMinutes": 0,
"executionOrder": 2
}
}
},
{
"name": "test",
"rank": 2,
"conditions": [
{
"name": "dev",
"conditionType": 2,
"value": "4"
}
],
"deployPhases": [
{
"rank": 1,
"phaseType": 1,
"name": "Agent job",
"refName": null,
"deploymentInput": {
"queueId": "{{.QueueID}}",
"agentSpecification": {
"identifier": "ubuntu-20.04"
}
},
"workflowTasks": [
{
"environment": {},
"taskId": "2a6ca863-f2ce-4f4d-8bcb-15e64608ec4b",
"version": "1.*",
"name": "Download flux creds",
"refName": "fluxCreds",
"enabled": true,
"alwaysRun": false,
"continueOnError": false,
"timeoutInMinutes": 0,
"definitionType": "task",
"overrideInputs": {},
"condition": "succeeded()",
"inputs": {
"secureFile": "black-washed",
"retryCount": "8",
"socketTimeout": ""
}
},
{
"environment": {
"USER_EMAIL": "{{.ApproverMail}}",
"ENVIRONMENT": "$(Release.EnvironmentName)",
"DESCRIPTION": "$(Release.ReleaseDescription)",
"URL": "$(Release.ReleaseWebURL)",
"PROJECT": "{{.BuildProjectName}}",
"CONTAINER": "{{.BuildServiceName}}",
"TAG": "$(Release.Artifacts.BuildPipeline.BuildNumber)",
"REPOSITORY": "finodigital.azurecr.io",
"WORKLOAD_TYPE": "deployment",
"NAMESPACE": "{{.BuildProjectName}}",
"WORKLOAD_NAME": "{{.BuildProjectName}}-{{.BuildServiceName}}",
"USER_NAME": "{{.ApproverName}}",
"FLUX_CREDS": "$(fluxCreds.secureFilePath)"
},
"taskId": "6c731c3c-3c68-459a-a5c9-bde6e6595b5b",
"version": "3.*",
"name": "Bash Script",
"refName": "",
"enabled": true,
"alwaysRun": false,
"continueOnError": false,
"timeoutInMinutes": 0,
"definitionType": "task",
"overrideInputs": {},
"condition": "succeeded()",
"inputs": {
"targetType": "filePath",
"filePath": "$(System.DefaultWorkingDirectory)/FluxDeployScript/flux-release.sh",
"arguments": "",
"workingDirectory": "",
"failOnStderr": "false",
"noProfile": "true",
"noRc": "true"
}
}
]
}
],
"retentionPolicy": {
"daysToKeep": 30,
"releasesToKeep": 3,
"retainBuild": true
},
"preDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": false,
"isNotificationOn": false,
"approver": {
"displayName": null,
"id": "{{.ApproverID}}"
}
}
],
"approvalOptions": {
"requiredApproverCount": null,
"releaseCreatorCanBeApprover": false,
"autoTriggeredAndPreviousEnvironmentApprovedCanBeSkipped": false,
"enforceIdentityRevalidation": false,
"timeoutInMinutes": 0,
"executionOrder": 1
}
},
"postDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": true,
"isNotificationOn": false
}
],
"approvalOptions": {
"requiredApproverCount": null,
"releaseCreatorCanBeApprover": false,
"autoTriggeredAndPreviousEnvironmentApprovedCanBeSkipped": false,
"enforceIdentityRevalidation": false,
"timeoutInMinutes": 0,
"executionOrder": 2
}
}
},
{
"name": "prod",
"rank": 3,
"conditions": [
{
"name": "test",
"conditionType": 2,
"value": "4"
}
],
"deployPhases": [
{
"rank": 1,
"phaseType": 1,
"name": "Agent job",
"refName": null,
"deploymentInput": {
"queueId": "{{.QueueID}}",
"agentSpecification": {
"identifier": "ubuntu-20.04"
}
},
"workflowTasks": [
{
"environment": {},
"taskId": "2a6ca863-f2ce-4f4d-8bcb-15e64608ec4b",
"version": "1.*",
"name": "Download flux creds",
"refName": "fluxCreds",
"enabled": true,
"alwaysRun": false,
"continueOnError": false,
"timeoutInMinutes": 0,
"definitionType": "task",
"overrideInputs": {},
"condition": "succeeded()",
"inputs": {
"secureFile": "black-wahsed",
"retryCount": "8",
"socketTimeout": ""
}
},
{
"environment": {
"USER_EMAIL": "{{.ApproverMail}}",
"ENVIRONMENT": "$(Release.EnvironmentName)",
"DESCRIPTION": "$(Release.ReleaseDescription)",
"URL": "$(Release.ReleaseWebURL)",
"PROJECT": "{{.BuildProjectName}}",
"CONTAINER": "{{.BuildServiceName}}",
"TAG": "$(Release.Artifacts.BuildPipeline.BuildNumber)",
"REPOSITORY": "finodigital.azurecr.io",
"WORKLOAD_TYPE": "deployment",
"NAMESPACE": "{{.BuildProjectName}}",
"WORKLOAD_NAME": "{{.BuildProjectName}}-{{.BuildServiceName}}",
"USER_NAME": "{{.ApproverName}}",
"FLUX_CREDS": "$(fluxCreds.secureFilePath)"
},
"taskId": "6c731c3c-3c68-459a-a5c9-bde6e6595b5b",
"version": "3.*",
"name": "Bash Script",
"refName": "",
"enabled": true,
"alwaysRun": false,
"continueOnError": false,
"timeoutInMinutes": 0,
"definitionType": "task",
"overrideInputs": {},
"condition": "succeeded()",
"inputs": {
"targetType": "filePath",
"filePath": "$(System.DefaultWorkingDirectory)/FluxDeployScript/flux-release.sh",
"arguments": "",
"workingDirectory": "",
"failOnStderr": "false",
"noProfile": "true",
"noRc": "true"
}
}
]
}
],
"retentionPolicy": {
"daysToKeep": 30,
"releasesToKeep": 3,
"retainBuild": true
},
"preDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": false,
"isNotificationOn": false,
"approver": {
"displayName": null,
"id": "{{.ApproverID}}"
}
}
],
"approvalOptions": {
"requiredApproverCount": null,
"releaseCreatorCanBeApprover": false,
"autoTriggeredAndPreviousEnvironmentApprovedCanBeSkipped": false,
"enforceIdentityRevalidation": false,
"timeoutInMinutes": 0,
"executionOrder": 1
}
},
"postDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": true,
"isNotificationOn": false
}
],
"approvalOptions": {
"requiredApproverCount": null,
"releaseCreatorCanBeApprover": false,
"autoTriggeredAndPreviousEnvironmentApprovedCanBeSkipped": false,
"enforceIdentityRevalidation": false,
"timeoutInMinutes": 0,
"executionOrder": 2
}
}
}
],
"triggers": [
{
"branchFilters": [
"{{.BuildRepoDefaultBranch}}"
],
"alias": "BuildRepo",
"triggerType": 3
}
]
According to your description, I tested it and everything works as expected.
Steps:
Get the release definition via the REST API Definitions - Get and copy the response body.
GET https://vsrm.dev.azure.com/{organization}/{project}/_apis/release/definitions/{definitionId}?api-version=6.1-preview.4
Create the new release pipeline via the REST API Definitions - Create
POST https://vsrm.dev.azure.com/{organization}/{project}/_apis/release/definitions?api-version=6.1-preview.4
Copy the response body and rename the field name to New release pipeline2, then mark it as request body.
I am using PostMan.
Result:
Update1
It seems that you are missing the field environmentOptions field in the request body, which contains publishDeploymentStatus, which controls the feature you are missing.
If you do not configure it or set the value to false, you will not see the Status of the Release in the commit page.
"environmentOptions": {
"emailNotificationType": "OnlyOnFailure",
"emailRecipients": "release.environment.owner;release.creator",
"skipArtifactsDownload": false,
"timeoutInMinutes": 0,
"enableAccessToken": false,
"publishDeploymentStatus": false,
"badgeEnabled": false,
"autoLinkWorkItems": false,
"pullRequestDeploymentEnabled": false
},
Result:

Post grafana dashboard to particular folder

I am trying to use the grafana API to post dashboards to a specific folder. Using the following command, I can see the folder ID's for all folders in my grafana:
curl -X GET http://<username>:<password>#localhost:3000/api/folders?limit=200
[{"id":9,"uid":"6m0M3AZZk","title":"Apps"},{"id":38,"uid":"jEJ5aSVZz","title":"Cluster_Health"},{"id":31,"uid":"vsmJ2dGZz","title":"CPU by App"},{"id":51,"uid":"Fx9ajQXWz","title":"Data Pipeline"},{"id":6,"uid":"dYFMMhZWz","title":"home"},{"id":19,"uid":"qDwG6yWZz","title":"Node_Health"},{"id":18,"uid":"37pWeyWZk","title":"Pending_Data"},{"id":44,"uid":"nreWbxfWz","title":"Prod"},{"id":13,"uid":"PYzEBYZWk","title":"Services"},{"id":27,"uid":"byVe4IMWk","title":"API"}]
Now, I would like to post a dashboard to my Services folder (id 13). However, when I make my request, this dashboard is always going to the General folder. I am using a python script to make my request:
def post_dashboard(filepath):
with open(filepath, "r") as fin:
data = json.loads(fin.read())
data = json.dumps(data)
response = requests.post("http://localhost:3000/api/dashboards/db", headers=headers_raw, data=data)
print(response.json())
print(response.status_code)
My JSON file looks like this:
{"dashboard": {
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": null,
"iteration": 1593098750052,
"links": [],
"panels": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus-1",
"description": "The amount of CPU taken up by redis from top command",
"fill": 0,
"gridPos": {
"h": 8,
"w": 24,
"x": 0,
"y": 0
},
"id": 10,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "app_cpu{node_type=\"process\", cluster_id=~\"$cluster\", app_name=~\".*redisserver.*\"}",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "{{ host_name }}",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "CPU Used",
"tooltip": {
"shared": true,
"sort": 2,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus-1",
"description": "The current amount of memory redis is consuming",
"fill": 0,
"gridPos": {
"h": 9,
"w": 12,
"x": 0,
"y": 8
},
"id": 2,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "redis_mem_used{cluster_id=~\"$cluster\"}",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "{{ node }}",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Redis Memory Used",
"tooltip": {
"shared": true,
"sort": 2,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "decbytes",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus-1",
"description": "The maximum amount of memory that redis has used",
"fill": 0,
"gridPos": {
"h": 9,
"w": 12,
"x": 12,
"y": 8
},
"id": 4,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "redis_mem_peak{cluster_id=~\"$cluster\"}",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "{{ node }}",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Redis Peak Memory",
"tooltip": {
"shared": true,
"sort": 2,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "decbytes",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus-1",
"description": "The amount of memory used by the LUA engine inside of redis",
"fill": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 17
},
"id": 6,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "redis_mem_lua{cluster_id=~\"$cluster\"}",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "{{ node }}",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "LUA Mem Used",
"tooltip": {
"shared": true,
"sort": 2,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "decbytes",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "Prometheus-1",
"description": "The amount of memory used as observed by top",
"fill": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 17
},
"id": 8,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"percentage": false,
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "redis_mem_rss{cluster_id=~\"$cluster\"}",
"format": "time_series",
"intervalFactor": 1,
"legendFormat": "{{ node }}",
"refId": "A"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "RSS Mem Used",
"tooltip": {
"shared": true,
"sort": 2,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "decbytes",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
}
],
"schemaVersion": 18,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"allValue": null,
"current": {},
"datasource": "Prometheus-1",
"definition": "label_values(redis_mem_used, cluster_id)",
"hide": 0,
"includeAll": true,
"label": null,
"multi": true,
"name": "cluster",
"options": [],
"query": "label_values(redis_mem_used, cluster_id)",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
}
]
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"timezone": "",
"title": "Redis",
"uid": "rfdsk32",
"folder": "Services",
"folderTitle": "Services",
"folderId": 13,
"overwrite": true
}
}
My grafana version is 6.2.0. I have used several references that say that folderId should be the controlling keyword for which folder a dashboard goes to.
https://grafana.com/docs/grafana/latest/http_api/dashboard/#create-update-dashboard
You have used wrong payload structure:
{
"dashboard": {
...
"folderId": 13,
"overwrite": true
}
}
Correct structure is:
{
"dashboard": {
...
},
"folderId": 13,
"overwrite": true
}

Cytoscape Dijkstra Algorithm off?

I'm trying to use Cytoscape to test Dijkstra's algorithm on various graphs. Using the graph below
It's easy to see that the shortest path from A to C would be A -> D -> E -> C.
When running Cytoscape's Djikstra's algorithm though
const dijkstra = cy.elements().dijkstra('#A', function(){
const weight = this.data('weight');
return weight;
}, false);
const pathToC = dijkstra.pathTo( cy.$('#C') );
const distToC = dijkstra.distanceTo( cy.$('#C') );
Cytoscape gives the output
A -> B -> C
which is definitely wrong.
Am I doing something wrong? Or is Cytoscape's algorithm off?
PS Code to generate the graph in Cytoscape is
{
"elements": {
"nodes": [
{
"data": {
"id": "A"
},
"position": {
"x": 187,
"y": 135
},
"group": "nodes",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
},
{
"data": {
"id": "B"
},
"position": {
"x": 516,
"y": 128
},
"group": "nodes",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
},
{
"data": {
"id": "C"
},
"position": {
"x": 726,
"y": 302
},
"group": "nodes",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
},
{
"data": {
"id": "D"
},
"position": {
"x": 186,
"y": 447
},
"group": "nodes",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
},
{
"data": {
"id": "E"
},
"position": {
"x": 510,
"y": 445
},
"group": "nodes",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
}
],
"edges": [
{
"data": {
"id": "BA",
"source": "B",
"target": "A",
"weight": "100"
},
"position": {
"x": 514,
"y": 127
},
"group": "edges",
"removed": false,
"selected": true,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
},
{
"data": {
"id": "DA",
"source": "D",
"target": "A",
"weight": "1"
},
"position": {
"x": 187,
"y": 446
},
"group": "edges",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
},
{
"data": {
"id": "BD",
"source": "B",
"target": "D",
"weight": "100"
},
"position": {
"x": 516,
"y": 127
},
"group": "edges",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
},
{
"data": {
"id": "EB",
"source": "E",
"target": "B",
"weight": "100"
},
"position": {
"x": 500,
"y": 442
},
"group": "edges",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
},
{
"data": {
"id": "ED",
"source": "E",
"target": "D",
"weight": "1"
},
"position": {
"x": 501,
"y": 443
},
"group": "edges",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
},
{
"data": {
"id": "CE",
"source": "C",
"target": "E",
"weight": "5"
},
"position": {
"x": 727,
"y": 304
},
"group": "edges",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
},
{
"data": {
"id": "BC",
"source": "B",
"target": "C",
"weight": "5"
},
"position": {
"x": 521,
"y": 132
},
"group": "edges",
"removed": false,
"selected": false,
"selectable": true,
"locked": false,
"grabbable": true,
"classes": ""
}
]
},
"style": [
{
"selector": "node",
"style": {
"background-color": "#666",
"label": "data(id)"
}
},
{
"selector": "edge",
"style": {
"width": "3px",
"label": "data(weight)",
"line-color": "#ccc",
"target-arrow-color": "#ccc",
"target-arrow-shape": "triangle"
}
}
],
"zoomingEnabled": true,
"userZoomingEnabled": true,
"zoom": 1,
"minZoom": 1.0e-50,
"maxZoom": 1.0e+50,
"panningEnabled": true,
"userPanningEnabled": true,
"pan": {
"x": 0,
"y": 0
},
"boxSelectionEnabled": true,
"renderer": {
"name": "canvas"
}
}
I'm having the same issue, pretty much same code.
Done some debugging, looks like the dist object is concatenating strings rather than adding integers.
dist: Object
AMS11: "0474483" -> 0, 4, 74, 483 should really be 561
BRU11: Infinity
FRA11: Infinity
GVA11: Infinity
LON11: "0474" -> 0, 4, 74 should really be 78
LON21: 0
LON22: "04" -> 0, 4 should really be 4
LON31: "047415" -> 0, 4, 74, 15 should really be 93
LUX21: Infinity
LUX31: Infinity
MOW11: Infinity
MOW12: Infinity
PAR11: "049693"
PAR21: "0474805"
STO21: Infinity
STO31: Infinity
TYO11: Infinity
TYO12: Infinity
Edit: Answer is to change your weights to integers so use "weight": 1 instead of "weight": "1".