build( "UPGRADE_LOGGED_94" )
parallel (
// job 1, 2 and 3 will be scheduled in parallel.
{ build("LOGGED_SMOKE_TICKET") },
{ build("LOGGED_SMOKE_SALESLEAD") },
{ build("LOGGED_SMOKE_SEARCH") },
{ build("LOGGED_SMOKE_HOME") },
{ build("LOGGED_SMOKE_BUSINESS") },
{ build("LOGGED_SMOKE_ANNOUNCEMENT") },
{ build("LOGGED_SMOKE_PROJECT") },
{ build("LOGGED_SMOKE_CHANGEREQ") },
{ build("LOGGED_SMOKE_CALENDAR") },
{ build("LOGGED_SMOKE_CUSTOMER") },
{ build("LOGGED_SMOKE_DEVELOPREQ") },
{ build("LOGGED_SMOKE_NAVIGATION") },
{ build("LOGGED_SMOKE_NOTIFICATION") },
{ build("LOGGED_SMOKE_RECURWORKFLOW") },
{ build("LOGGED_SMOKE_SLLIFE") },
{ build("LOGGED_SMOKE_REPORTING") },
{ build("LOGGED_SMOKE_TASK") },
{ build("LOGGED_SMOKE_TRIAGE") },
{ build("LOGGED_SMOKE_USER") },
{ build("LOGGED_SMOKE_WORKFLOW") },
)
ignore(ABORTED ) {
parallel (
{build( "LOGGED_SMOKE_TICKETLIFE" )},
{build( "LOGGED_SMOKE_WORKFLOWLIFE" )}
)
}
Use IGNORE sentence in upstream job. For example there is job 1 and job 2
build("job1")
build("job2")
if you want job2 will be executed even if job1 fails, you should write
IGNORE(FAILURE){
build("job1")
}
build("job2")
Related
Hi I am trying to update nested filed , but couldn't able to do so.
Here is the sample data,
[{
"_id": {
"$oid": "632ec4128f567511dcd80ed9"
},
"company_id": 1,
"contact_id": 1001,
"roles_to_be_accepted": {
"ROLE#04": {
"assigned_data": {
"assigned_3HFui": {
"is_idle": false,
"send_for_acceptance_date": 1664009233,
"action_date": ""
},
"assigned_b1J9t": {
"is_idle": false,
"send_for_acceptance_date": 1664009233,
"action_date": ""
}
}
},
"ROLE#02": {
"assigned_data": {
"assigned_uPJI1": {
"is_idle": false,
"send_for_acceptance_date": 1664009233,
"action_date": ""
}
}
}
}
}]
Now I want to update that is_idle field to true. I have tried in this way
let query = { contact_id: 1, company_id: 1001};
const db = this.client.db("dbname");
const col= db.collection("collection_name");
col.update(query, {
'$set': { "roles_to_be_accepted.assigned_data.is_idle": true }
});
I'm trying to get dependencyGraphManifests of a particular branch only, such as the default branch, I'm not really sure if this is even possible.
Here is my full query:
query orgRepos {
organization(login: "octokit") {
id
repositories(
first: 2
orderBy: {field: CREATED_AT, direction: ASC}
) {
edges {
node {
defaultBranchRef {
name
repository {
url
name
dependencyGraphManifests(withDependencies: true) {
totalCount
edges {
node {
blobPath
dependencies {
nodes {
packageName
requirements
}
}
}
}
}
}
}
}
}
}
}
}
But the response returns every manifest file.
Here is a simplified response:
"node": {
"defaultBranchRef": {
"name": "main",
"repository": {
"url": "https://github.com/octokit/octokit.js",
"name": "octokit.js",
"dependencyGraphManifests": {
"totalCount": 7,
"edges": [
{
"node": {
"blobPath": "/octokit/octokit.js/blob/main/package-lock.json"
}
},
{
"node": {
"blobPath": "/octokit/octokit.js/blob/main/package.json"
}
},
{
"node": {
"blobPath": "/octokit/octokit.js/blob/main/docs/package.json"
}
},
{
"node": {
"blobPath": "/octokit/octokit.js/blob/main/.github/workflows/release.yml"
}
},
{
"node": {
"blobPath": "/octokit/octokit.js/blob/main/.github/workflows/test.yml"
}
},
{
"node": {
"blobPath": "/octokit/octokit.js/blob/main/.github/workflows/update-prettier.yml"
}
}
]
}
}
}
}
It also worth noting that some of the blobpaths return invalid paths, such as /octokit/octokit.js/blob/main/docs/package.json, which doesn't actually exists on the default branch(its on a different branch). Is this a bug?
I am running into an issue where I'm trying to grab some documents near the current document in a lookup. If I manually enter the lon/lat the following query will work but it fails with trying to use anything from the "let". How can I reference the location of the parent document in the geoNear in the lookup pipeline?
[
{
"$match":{
'assessed_improvement_value':{'$gt':500},
'sqft':{'$gt':500}
}
},
{
"$lookup":{
"from":"properties",
"let":{
'lon':{"$arrayElemAt":["$location.coordinates",0]},
'lat':{"$arrayElemAt":["$location.coordinates",1]},
},
'pipeline': [
{
"$geoNear": {
"near": { "type": "Point", "coordinates": [ "$$lon" , "$$lat" ] },
"distanceField": "distance",
"spherical": true
}
},
{"$limit":10}
],
"as":"comps",
}
},
{"$limit":10}
]
Update
The first method I posted was in fact a mess. I've now came up with a much cleaner solution. I hope this helps someone in the future
[
{
"$lookup":{
"from":"properties",
"let":{
'plon':{"$arrayElemAt":["$location.coordinates",0]},
'plat':{"$arrayElemAt":["$location.coordinates",1]},
},
'pipeline': [
{
"$addFields":{
"distance":{
"$function":{
"body":"""
function(plonRad,platRad, lonRad, latRad) {
var R = 6373.0;
var dlon = lonRad - plonRad;
var dlat = latRad - platRad;
if((dlon == 0) || (dlat == 0)) {
return 0;
}
var a = Math.pow(Math.sin(dlat / 2),2)+ Math.cos(platRad) * Math.cos(latRad) * Math.pow(Math.sin(dlon / 2),2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
var dist = R * c;
return dist*0.621371;
}
""",
"args":[
{"$toDouble":{"$degreesToRadians":"$$plon"}},
{"$toDouble":{"$degreesToRadians":"$$plat"}},
{"$toDouble":{"$degreesToRadians":{"$arrayElemAt":["$location.coordinates",0]}}},
{"$toDouble":{"$degreesToRadians":{"$arrayElemAt":["$location.coordinates",1]}}}],
"lang":"js"
}
}
}
},
{
"$match":{
"distance":{"$gt":0}
}
},
{"$sort":{"distance":1}},
{"$limit":20}
],
"as":"comps",
}
}
]
I guess this is an old bug that was never fixed for whatever reason. This feels like a mess but it is a working solution. This manually calculates the distance in miles.
[
{
"$match":{
'assessed_improvement_value':{'$gt':500},
'sqft':{'$gt':500}
}
},
{
"$lookup":{
"from":"properties",
"let":{
'lon':{"$arrayElemAt":["$location.coordinates",0]},
'lat':{"$arrayElemAt":["$location.coordinates",1]},
},
'pipeline': [
{
"$addFields": {
'plonRad':{"$degreesToRadians":"$$lon"},
'platRad':{"$degreesToRadians":"$$lat"},
'lonRad':{"$degreesToRadians":{"$arrayElemAt":["$location.coordinates",0]}},
'latRad':{"$degreesToRadians":{"$arrayElemAt":["$location.coordinates",1]}},
}
},
{
'$addFields':{
"dlon":{
"$subtract":["$plonRad", "$lonRad"]
},
"dlat":{
"$subtract":["$platRad", "$latRad"]
},
}
},
{
"$addFields":{
'a':{
"$multiply":[
{
"$add":[
{
"$pow":[
{
"$sin":{
"$divide":["$dlat",2]
}
},
2
]
},
{
"$cos":"$platRad"
}
]
},
{
"$add":[
{
"$pow":[
{
"$sin":{
"$divide":["$dlon",2]
}
},
2
]
},
{
"$cos":"$latRad"
}
]
}
]
},
}
},
{
"$addFields":{
"c":{
"$atan2":[
{"$sqrt":"$a"},
{"$sqrt":{"$subtract":[1,"$a"]}}
]
}
}
},
{
"$addFields":{
"distance":{
"$divide":[
{"$multiply":[6373.0,"$c"]},
1609.34
]
}
}
},
{"$limit":10}
],
"as":"comps",
}
},
{"$limit":10}
]
I'm trying to group all this object in one, the idea is to combine all the object.
My function know is like this:
app.get('/stats/:id(\\d+)/weapon/:weapon', function(req, res, next) {
db.collection('stats').aggregate( [
{ $match: { _id: parseInt(req.params.id, 10) } },
{ $unwind: "$session" },
{ $addFields: { weapon: { $objectToArray: '$session.weapons.' + sanitize(req.params.weapon) }, _id: false } },
{ $addFields: { weapon: { $arrayToObject: "$weapon" } } },
{ $project: { weapon: "$weapon", _id: false } }
], function(err, doc) {
if( !err ) {
res.json(doc);
}
else {
console.log(err);
res.end();
}
});
});
and return something like this:
[
{
"weapon":{
"shots":30,
"hitbox":{
"head":7,
"chest":4
},
"kills":4,
"dmg":590
}
},
{
"weapon":{
"shots":46,
"kills":4,
"hitbox":{
"head":3,
"chest":4,
"stomach":3,
"left_leg":2
},
"hs":3,
"dmg":479
}
},
{
"weapon":{
"shots":30,
"hitbox":{
"head":7,
"chest":4
},
"kills":4,
"dmg":590
}
}
]
My idea is to return only one instance of weapon with the sum key by key.
I already try $group and concat array but i can't get the result that i want...
I want like this:
[
{
"weapon":{
"shots":160,
"hitbox":{
"head":17,
"chest":12,
"stomach":3,
"left_leg":2
},
"kills":12,
"hs":3,
"dmg":1659
}
}
]
I have users array with their name,
var users = [{'name':'zulekha'}, {'name':'deepika'}];
I am fetching worklogged by each user from jira APIs. So I am getting object like this.
var worklogResult = {
"issues": [
{
"fields": {
"worklog": {
"worklogs": [
{
"author": {
"name": "zulekha",
},
"timeSpentSeconds": 180
},
{
"author": {
"name": "deepika",
},
"timeSpentSeconds": 210
}
]
}
}
},
{
"fields": {
"worklog": {
"worklogs": [
{
"author": {
"name": "deepika",
},
"timeSpentSeconds": 140
}
]
}
}
},
{
"fields": {
"worklog": {
"worklogs": [
{
"author": {
"name": "zulekha",
},
"timeSpentSeconds": 600,
}
]
}
}
},
{
"fields": {
"worklog": {
"worklogs": []
}
}
}
]
}
Now I want to match worklogResult with users in such a way that I can get following output.
output = [{'name':'zulekha','timeSpentSeconds':780}, {'name':'deepika', 'timeSpentSeconds':350}]
Can anyone suggest me how to achieve this?
use _.flatMap to flat nested objects
_.chain(worklogResult.issues)
.flatMap('fields.worklog.worklogs')
.thru(function(spents) {
return _.map(users, function(user) {
return _.merge(user, {
timeSpentSeconds: _.chain(spents)
.filter(['author.name', user.name])
.map('timeSpentSeconds')
.sum()
.value()
})
})
})
.value()