mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 10:27:09 +00:00
Adapt QC endpoints to new configuration APIs
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const YAML = require('yaml');
|
const YAML = require('yaml');
|
||||||
const flattenQCDefinitions = require('../../../utils/flattenQCDefinitions');
|
const flattenQCDefinitions = require('../../../utils/flattenQCDefinitions');
|
||||||
const configuration = require('../../configuration'); // lib/db/configuration
|
const project = require('../../project'); // lib/db/project
|
||||||
|
|
||||||
|
|
||||||
async function get (projectId, opts = {}) {
|
async function get (projectId, opts = {}) {
|
||||||
const qcConfig = await configuration.get(projectId, "qc");
|
const qcConfig = (await project.configuration.get(projectId))?.qc;
|
||||||
if (qcConfig?.definitions) {
|
if (qcConfig?.definitions) {
|
||||||
try {
|
try {
|
||||||
const definitions = YAML.parse(fs.readFileSync(qcConfig.definitions).toString());
|
const definitions = YAML.parse(fs.readFileSync(qcConfig.definitions).toString());
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ function forceQC (projectId, sequenceNumber) {
|
|||||||
|
|
||||||
async function getProjectQCConfig (projectId) {
|
async function getProjectQCConfig (projectId) {
|
||||||
console.log("getProjectQCConfig");
|
console.log("getProjectQCConfig");
|
||||||
const qcConfig = await configuration.get(projectId, "qc");
|
const qcConfig = (await project.configuration.get(projectId))?.qc;
|
||||||
console.log("qcConfig", qcConfig);
|
console.log("qcConfig", qcConfig);
|
||||||
if (qcConfig?.definitions && qcConfig?.parameters) {
|
if (qcConfig?.definitions && qcConfig?.parameters) {
|
||||||
const definitions =
|
const definitions =
|
||||||
@@ -57,11 +57,11 @@ async function main () {
|
|||||||
// Fetch list of projects
|
// Fetch list of projects
|
||||||
console.log("GET PROJECTS");
|
console.log("GET PROJECTS");
|
||||||
const projects = await project.get();
|
const projects = await project.get();
|
||||||
console.log("PROJECTS", projects);
|
|
||||||
|
|
||||||
for (const proj of projects) {
|
for (const {pid} of projects) {
|
||||||
const projectId = proj.pid;
|
const projectId = pid;
|
||||||
console.log("PROJECT ID", projectId);
|
console.log("PROJECT ID", projectId);
|
||||||
|
const proj = await project.configuration.get(projectId);
|
||||||
|
|
||||||
if (!proj.archived) {
|
if (!proj.archived) {
|
||||||
const QCTstamp = new Date();
|
const QCTstamp = new Date();
|
||||||
@@ -75,7 +75,7 @@ async function main () {
|
|||||||
console.log("currentQCHash != lastQCHash", projectId, currentQCHash, lastQCHash);
|
console.log("currentQCHash != lastQCHash", projectId, currentQCHash, lastQCHash);
|
||||||
|
|
||||||
// Fetch definitions and parameters
|
// Fetch definitions and parameters
|
||||||
const { definitions, parameters } = await getProjectQCConfig(projectId) ?? {};
|
const { definitions, parameters } = await getProjectQCConfig(projectId, proj.qc) ?? {};
|
||||||
|
|
||||||
if (definitions && parameters) {
|
if (definitions && parameters) {
|
||||||
console.log("PROJECT ID", projectId);
|
console.log("PROJECT ID", projectId);
|
||||||
|
|||||||
Reference in New Issue
Block a user