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

cleaner job manager API for initializing the job database #636

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

soxofaan
Copy link
Member

brainstorm PR for #635 to have cleaner job db initialization

@jdries
Copy link
Collaborator

jdries commented Sep 27, 2024

Already looks good, we could to a factory method like:
job_db = create_job_db(output_file,df)
And then 'guess' the tye of db by looking at file extension or else make it more explicit.
The difference with:
job_db = CsvJobDatabase(output_file).initialize_from_df(df)
is however minimal, so this version is also just fine for me.

@soxofaan
Copy link
Member Author

yeah I was considering something like that, e.g.:

job_db = CsvJobDatabase(output_file, initialize_from=df)

But then I figured that splitting it in a separate method allows the user to do the following in their scripts:

job_db = CsvJobDatabase(output_file)
if not job_db.exists() or some_other_condition():
    job_db.initialize_from_df(df=get_df())

giving them the freedom to do the initialization in the way that makes most sense to them

@jdries jdries marked this pull request as ready for review October 2, 2024 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants