Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[O2B-1420] Add CTP readout host to FLP hosts #1838

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/database/seeders/20220412122043-environments.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ module.exports = {
odc_topology: 'topology',
odc_n_epns: '2',
readout_cfg_uri: 'file:///local/replay/2024-04-17-pp-650khz-synt-4tf/readout-replay-24g-dd40.cfg',
ctp_readout_enabled: true,
ctp_readout_host: 'fake-ctp-host',
}),
},
// Destroyed
Expand Down
18 changes: 16 additions & 2 deletions lib/server/services/run/RunService.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
}
}

return this.get({ runId }, { runType: true, detectors: true, lhcPeriod: true });
return this.get({ runId }, { runType: true, detectors: true, lhcPeriod: true, flpRoles });
});
}

Expand Down Expand Up @@ -480,6 +480,19 @@
let hosts = [];
try {
hosts = configuration.getArray('hosts');

/*
* If the run has CTP readout enabled, we need to add the CTP host in the list of hosts
* The reason is that hosts is defined manually using AliECS GUI to have fine grained control over enabled FLPs, but CTP readout is
* a boolean which runs automatically on a dedicated host
*/
const ctp_readout_enabled = configuration.getBool('ctp_readout_enabled');
if (ctp_readout_enabled) {
const ctp_readout_host = configuration.getString('ctp_readout_host');
if (ctp_readout_host) {
hosts.push(ctp_readout_host);

Check warning on line 493 in lib/server/services/run/RunService.js

View check run for this annotation

Codecov / codecov/patch

lib/server/services/run/RunService.js#L489-L493

Added lines #L489 - L493 were not covered by tests
}
}
} catch (e) {
onError(e);
}
Expand All @@ -493,6 +506,7 @@
} catch (e) {
onError(e);
}

let triggerEnabled = false;
try {
triggerEnabled = configuration.getBool('trg_enabled');
Expand Down Expand Up @@ -533,7 +547,7 @@
partialRun.pdpBeamType = configuration.getString('pdp_beam_type');
partialRun.epnTopology = configuration.getString('odc_topology');
partialRun.nEpns = configuration.getString('odc_n_epns');
partialRun.nFlps = (hosts?.length ?? 0) + (ctp ? 1 : 0); // Add 1 for ctp flp which is not in hosts
partialRun.nFlps = hosts?.length ?? 0;

Check warning on line 550 in lib/server/services/run/RunService.js

View check run for this annotation

Codecov / codecov/patch

lib/server/services/run/RunService.js#L550

Added line #L550 was not covered by tests
partialRun.readoutCfgUri = configuration.getString('readout_cfg_uri');

return {
Expand Down
1 change: 1 addition & 0 deletions test/lib/server/services/run/RunService.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -718,5 +718,6 @@ module.exports = () => {
expect(run.readoutCfgUri).to.equal('file:///local/replay/2024-04-17-pp-650khz-synt-4tf/readout-replay-24g-dd40.cfg');
expect(run.userIdO2Start).to.equal(1);
expect(run.userIdO2Stop).to.equal(2);
expect(run.flpRoles.map(({ name }) => name)).to.deep.equal(['fake-flp1', 'fake-flp2', 'fake-ctp-host']);
});
};
2 changes: 1 addition & 1 deletion test/public/envs/detailsPage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ module.exports = () => {
await waitForNavigation(page, () => pressElement(page, '#rowCmCvjNbg a:first-of-type'));
await pressElement(page, '#raw-configuration-tab');

await waitForTableLength(page, 18);
await waitForTableLength(page, 20);
expect(await page.evaluate(() => {
const cellContents = Array.from(document.querySelectorAll('table tbody tr td:first-child')).map((element) => element.innerText);
return cellContents.every((v, i) => !i || v.localeCompare(cellContents[i - 1]) >= 0);
Expand Down
Loading