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

support reading data from TOML files #216

Open
cmoussa1 opened this issue Mar 4, 2022 · 1 comment
Open

support reading data from TOML files #216

cmoussa1 opened this issue Mar 4, 2022 · 1 comment
Labels
idea An idea for a new feature or change

Comments

@cmoussa1
Copy link
Member

cmoussa1 commented Mar 4, 2022

Feel free to add to this issue with any other ideas or suggestions.

The changes proposed in PR #207 introduce using queue information to help further calculate a job's priority. The data for these queues are defined in the queue_table in the flux-accounting database, but to my knowledge are also defined in a TOML file for fluxion. This leaves the potential for inconsistency between the two modules (flux-accounting and flux-sched) if one is updated but not the other. For example, the TOML file for fluxion has information concerning 3 queues (bronze, silver, gold), but the flux-accounting DB has 4 rows in its queue_table (bronze, silver, gold, platinum). So, as of now, it's up to system administrators or scheduler operators to keep track of these two sets of information and ensure they are consistent.

It might be worth changing the way flux-accounting retrieves queue information so that there is only one place that queues need to be defined and configured. Perhaps flux-accounting could be responsible for reading the TOML file that fluxion has to fetch queue information and import it into its queue_table, which would then be sent to the priority plugin via RPC. It would then remove the need for the add-queue, delete-queue, and edit-queue commands, since all of that configuration would happen with the TOML file.

Or maybe it could just skip the import into the flux-accounting DB and could just read the TOML file for queue information and send it directly to the priority plugin in the bulk-update script flux-account-priority-update.py.

I'm not too familiar with reading data from TOML files but it looks like Python has support for reading and converting it into a Python object. https://pypi.org/project/toml/

@cmoussa1 cmoussa1 added the idea An idea for a new feature or change label Mar 4, 2022
@cmoussa1
Copy link
Member Author

Just wanted to update this issue. Looks like Python has some pretty strong and easy-to-learn support for reading TOML files and configurations.

import toml

data = toml.load("sample.toml")
print(toml.dumps(data)) 
[basics]
first_name = "christopher"
last_name = "moussa"
age = 25

We can either print the contents of the file itself, or access specific elements within this file by treating it like a Python dictionary (the more likely scenario):

first_name = data["basics"]["first_name"]
print("first name:", first_name)
first name: christopher

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea An idea for a new feature or change
Projects
None yet
Development

No branches or pull requests

1 participant