Skip to content

Commit

Permalink
Merge pull request #9 from pmandrik/master
Browse files Browse the repository at this point in the history
Gem & manual run update button updates
  • Loading branch information
pmandrik authored Mar 14, 2022
2 parents 32930ee + a17e4dd commit e941fe7
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 21 deletions.
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,6 @@ Check do you have sudo rights (optional):
```
sudo whoami
```

## FAQ
Check readme_faq.md
50 changes: 50 additions & 0 deletions readme_faq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#### Connect to DB
Like:
psql -h dbod-gc005.cern.ch -p 6601 -U username
using password & username obtained from DQM core

#### Delete entry from postgresql DB
\l
\c runregistry_database_dev
\dt+
SELECT * FROM public."Run" WHERE run_number = 346511;
DELETE FROM public."DatasetEvent" WHERE run_number = 346511;
DELETE FROM public."DatasetTripletCache" WHERE run_number = 346511;
DELETE FROM public."LumisectionEvent" WHERE run_number = 346511;
DELETE FROM public."OMSLumisectionEvent" WHERE run_number = 346511;
DELETE FROM public."Dataset" WHERE run_number = 346511;
DELETE FROM public."Run" WHERE run_number = 346511;
DELETE FROM public."RunEvent" WHERE run_number = 346511;

#### Change DB password
Follow:
https://dbod-user-guide.web.cern.ch/getting_started/postgresql.html

#### User authorization
https://auth.docs.cern.ch/user-documentation/faqs/

#### Add logic to GEM RR attributes
{"and": [{"var": "gem_included"}, {"or": [{"==": [{"var": "gemp_ready"}, false]}, {"==": [{"var": "gemm_ready"}, false]}]}]}
{"and": [{"var": "gem_included"}, {"and": [{"==": [{"var": "gemp_ready"}, true]}, {"==": [{"var": "gemm_ready"}, true]}]}]}

#### Moving docker images to cern registry
docker login docker.com
docker login registry.cern.ch

Following https://cms-http-group.docs.cern.ch/k8s_cluster/registry/

docker pull cmssw/runregistry-workers-dqm-gui-pinging:0.1-cmsweb
docker pull cmssw/runregistry-backend:0.2-cmsweb
docker pull cmssw/runregistry-frontend:0.2-cmsweb

docker tag cmssw/runregistry-workers-dqm-gui-pinging:0.1-cmsweb registry.cern.ch/cmsweb/runregistry-workers-dqm-gui-pinging:0.1-cmsweb
docker tag cmssw/runregistry-backend:0.2-cmsweb registry.cern.ch/cmsweb/runregistry-backend:0.2-cmsweb
docker tag cmssw/runregistry-frontend:0.2-cmsweb registry.cern.ch/cmsweb/runregistry-frontend:0.2-cmsweb

docker push registry.cern.ch/cmsweb/runregistry-workers-dqm-gui-pinging:0.1-cmsweb
docker push registry.cern.ch/cmsweb/runregistry-backend:0.2-cmsweb
docker push registry.cern.ch/cmsweb/runregistry-frontend:0.2-cmsweb

There is also tow images we were not able to pull from docker.com:
cmssw/runregistry-workers-oms-fetching
cmssw/runregistry-workers-json-processing
20 changes: 7 additions & 13 deletions runregistry_backend/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,13 @@ module.exports = {
acquire: 2000000,
},
WAITING_DQM_GUI_CONSTANT: 'waiting dqm gui',
API_URL: process.env.DOCKER_POSTGRES
? 'http://dev:9500'
: 'http://localhost:9500',
API_URL: process.env.DOCKER_POSTGRES ? 'http://dev:9500' : 'http://localhost:9500',
OMS_URL: `https://cmsoms.cern.ch/agg/api/v1`,
AUTH_SERVICE_URL:
'https://auth.cern.ch/auth/realms/cern/protocol/openid-connect/token',
AUTH_SERVICE_URL: 'https://auth.cern.ch/auth/realms/cern/protocol/openid-connect/token',
REDIS_URL: `redis://redis:6379`,
OMS_RUNS: (number_of_runs = 10) =>
`runs?sort=-last_update&page[limit]=${number_of_runs}`,
OMS_RUNS: (number_of_runs = 10) => `runs?sort=-last_update&page[limit]=${number_of_runs}`,
OMS_SPECIFIC_RUN: (run_number) => `runs?filter[run_number]=${run_number}`,
OMS_LUMISECTIONS: (run_number) =>
`lumisections?filter[run_number]=${run_number}&page[limit]=5000`,
OMS_LUMISECTIONS: (run_number) => `lumisections?filter[run_number]=${run_number}&page[limit]=5000`,
RUNS_PER_API_CALL: 49,
SECONDS_PER_API_CALL: 30,
DBS_URL: 'https://cmsweb.cern.ch/dbs/prod/global',
Expand Down Expand Up @@ -62,9 +57,7 @@ module.exports = {
acquire: 2000000,
},
WAITING_DQM_GUI_CONSTANT: 'waiting dqm gui',
API_URL: process.env.DOCKER_POSTGRES
? 'http://dev:9500'
: 'http://localhost:9500',
API_URL: process.env.DOCKER_POSTGRES ? 'http://dev:9500' : 'http://localhost:9500',
OMS_URL: `https://cmsoms.cern.ch/agg/api/v1`,
REDIS_URL: `redis://redis:6379`,
OMS_RUNS: (number_of_runs = 10) =>
Expand Down Expand Up @@ -307,7 +300,8 @@ module.exports = {
'hbhec_ready',
'beam2_stable',
'beam2_present',
'gem_ready',
'gemp_ready',
'gemm_ready',
],
oms_lumisection_luminosity_whitelist: [
// TODO: When OMS provides us with lumisection granular luminosity then we put the attribute here (not the aggregated one). And then there is no need to calculate it from brilcalc using their pip package
Expand Down
11 changes: 7 additions & 4 deletions runregistry_backend/cron/1.get_runs.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,8 @@ const fetch_runs = async (
await fetch_runs(fetch_amount * 2, false);
} else {
// Here we calculate the new_runs with ALL runs, instead of above with only the fetched runs:
const runs_to_be_saved = calculate_new_runs(
all_fetched_runs,
last_saved_runs
);
const runs_to_be_saved = calculate_new_runs(all_fetched_runs, last_saved_runs);

if (runs_to_be_saved.length > 0) {
console.log(`saving: ${runs_to_be_saved.length} runs`);
// The 0 in the second argument is to indicate is this the first time we try to save the runs (save_runs is recursive if it errors out on any run)
Expand Down Expand Up @@ -187,3 +185,8 @@ const get_max_run_number = (array_of_runs) => {
);
return max_run_number;
};





7 changes: 6 additions & 1 deletion runregistry_backend/cron/2.save_or_update_runs.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,9 @@ exports.update_runs = (
},
{
// The email HAS to start with auto, or else API won't know it's an automatic change (unless it was manually requested to update)
const email_template = email ? ` - ${email}` : '';
headers: {
email: `auto@auto${email ? ` - ${email}` : ''}`,
email: `auto@auto${email_template}`,
// comment: comment || 'automatic update from OMS',
comment: comment || 'run update',
// Avoid permission egroups problem:
Expand Down Expand Up @@ -269,3 +270,7 @@ exports.manually_update_a_run = async (
atomic_version,
});
};




Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ class EditRunLumisections extends Component {
}
return (
<div>
{run.significant ? (
<div style={{ overflowX: 'scroll' }}>

<br />
<div
style={{
Expand Down Expand Up @@ -86,6 +85,9 @@ class EditRunLumisections extends Component {
</Button>
</div>
<br />

{run.significant ? (
<div style={{ overflowX: 'scroll' }}>
<table className="edit_run_form">
<thead>
<tr className="table_header">
Expand Down Expand Up @@ -141,7 +143,7 @@ class EditRunLumisections extends Component {
<div>
In order to edit a run's lumisections the run{' '}
<i style={{ textDecoration: 'underline' }}>
must be marked significant first
must be marked significant first!
</i>
. <br /> <br />
You can mark a run significant by clicking 'make significant' in the
Expand Down
3 changes: 3 additions & 0 deletions runregistry_frontend/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ exports.lumisection_attributes = [
'esm_ready',
'esp_ready',
'fpix_ready',
'gemp_ready',
'gemm_ready',
'hbhea_ready',
'hbheb_ready',
'hbhec_ready',
Expand All @@ -218,3 +220,4 @@ exports.lumisection_attributes = [
'tob_ready',
'zdc_ready',
];

0 comments on commit e941fe7

Please sign in to comment.