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

Problem with MachineType name at several sites #219

Closed
mschnepf opened this issue Nov 24, 2021 · 2 comments · Fixed by #220
Closed

Problem with MachineType name at several sites #219

mschnepf opened this issue Nov 24, 2021 · 2 comments · Fixed by #220
Assignees
Labels
bug Something isn't working potential problem Avoid foreseeable misuse

Comments

@mschnepf
Copy link
Member

We renamed one of our sites (TOPAS -> TOPAS-CPU) and reused the MachineType names. TARDIS requested and managed the drones fine. However, the SqliteRegistry plugin did not insert new drones into the database. The log entry looks fine:

cobald.runtime.tardis.resources.dronestates: 2021-11-24 17:53:36 Drone {'site_name': 'TOPAS-CPU', 'machine_type': 'singlecore', 'obs_machine_meta_data_translation_mapping': {'Cores': 1, 'Memory': 1024, 'Disk': 1048576}, 'remote_resource_uuid': '8106081', 'created': date
time.datetime(2021, 11, 24, 17, 40, 36, 758136), 'updated': datetime.datetime(2021, 11, 24, 17, 40, 36, 758379), 'drone_uuid': 'topas-cpu-ab8da92526', 'resource_status': <ResourceStatus.Booting: 1>} in BootingState
cobald.runtime.tardis.resources.dronestates: 2021-11-24 17:53:36 Resource attributes: {'site_name': 'TOPAS-CPU', 'machine_type': 'singlecore', 'obs_machine_meta_data_translation_mapping': {'Cores': 1, 'Memory': 1024, 'Disk': 1048576}, 'remote_resource_uuid': '8106081', 
'created': datetime.datetime(2021, 11, 24, 17, 40, 36, 758136), 'updated': datetime.datetime(2021, 11, 24, 17, 40, 36, 758379), 'drone_uuid': 'topas-cpu-ab8da92526', 'resource_status': <ResourceStatus.Booting: 1>}

The MachineTypes tables in the database connect the site_id and the MachineType. The values for the site of the MachineTypes were not updated after the change of the configuration.

sqlite> select * from Sites;
1|TOPAS
602|TOPAS-CPU
187|TOPAS-GPU

sqlite> select * from MachineTypes;
1|singlecore|1
2|eightcore|1
25|eightcore_small|1
547|singlegpu|187
2218|testgpu|187

Therefore, the MachineType was assigned to the wrong site_id; as a result, the insertion of new drones failed. After an update of the entries in the MachineTypes table, it works fine.

Is it possible to include a sanity check or change the SQL insertion query to get an error message? That would help to detect such problems.

@mschnepf mschnepf added bug Something isn't working potential problem Avoid foreseeable misuse labels Nov 24, 2021
@rcaspart
Copy link
Member

rcaspart commented Nov 24, 2021

Maybe you should add a bit more information here. Part of the problem is the schema of the table MachineTypes (machine_type_id INTEGER PRIMARY KEY AUTOINCREMENT, machine_type VARCHAR(255) UNIQUE, site_id INTEGER, FOREIGN KEY(site_id) REFERENCES Sites(site_id)). As point out by @giffels part of the solution is to not decalre site_id and machine_type unique independent of each other (as is now) but add a contraint like CONSTRAINT UNIQUE_site_machinetype UNIQUE (machine_type,site_id) in the schema.

@giffels
Copy link
Member

giffels commented Nov 25, 2021

Thanks for the report. As @rcaspart pointed out this is a bug in the schema. I will take a look and fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working potential problem Avoid foreseeable misuse
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants