Hi @osinskit ,
Thanks for the post! You can certainly query the cryoSPARC MongoDB to gather aggregate information. First, enter the MongoDB shell:
cryosparcm mongo
Count of submitted/queued jobs by month:
db.jobs.aggregate([
{$match: { queued_at: { $ne: null }}},
{$group: { _id: { month: { $month: "$queued_at" }, year: { $year: "$queued_at" } }, count: {$sum: 1} }},
{$project: { _id: 0, year: '$_id.year', month: '$_id.month', count: 1 } },
{$sort: { year: 1, month: 1 }}
]);
Count of completed jobs by month:
db.jobs.aggregate([
{$match: { status: 'completed', completed_at: { $ne: null }}},
{$group: { _id: { month: { $month: "$completed_at" }, year: { $year: "$completed_at" } }, count: {$sum: 1} }},
{$project: { _id: 0, year: '$_id.year', month: '$_id.month', count: 1 } },
{$sort: { year: 1, month: 1 }}
]);
Count and runtime (seconds) of completed jobs since Jan 1, 2022 grouped by job type:
db.jobs.aggregate([
{ $match: { status: 'completed', deleted: false, completed_at: { $gte: new Date('January 1, 2022'), $lt: new Date() } } },
{ $project: { job_type: 1, running_at: 1, completed_at: 1, duration: {$divide: [{$subtract: ["$completed_at", "$running_at"]}, 1000]} } },
{ $group: { '_id': '$job_type', count: { $sum: 1 }, totalTimeSec: { $sum: '$duration' } } },
{ $sort: { totalTimeSec: -1 } }
])
Count and runtime (seconds) of completed jobs since Jan 1, 2022 grouped by date:
db.jobs.aggregate([
{ $match: { status: 'completed', deleted: false, completed_at: { $gte: new Date('January 1, 2022'), $lt: new Date() } } },
{ $project: { job_type: 1, running_at: 1, completed_at: 1, duration: {$divide: [{$subtract: ["$completed_at", "$running_at"]}, 1000]}, day: { $dateToString: { date: '$completed_at', format: '%Y-%m-%d' } } } },
{ $group: { '_id': '$day', count: { $sum: 1 }, totalTimeSec: { $sum: '$duration' } } },
{ $sort: { totalTimeSec: -1 } }
])
Hope that helps!
- Suhail