Skip to content

Submit runlist#54

Merged
maxnoe merged 6 commits into
masterfrom
submit_runlist
Mar 1, 2018
Merged

Submit runlist#54
maxnoe merged 6 commits into
masterfrom
submit_runlist

Conversation

@maxnoe
Copy link
Copy Markdown
Member

@maxnoe maxnoe commented Dec 7, 2017

No description provided.

tarrox
tarrox previously requested changes Dec 10, 2017

@click.command()
@click.argument('runlist')
@click.argument('jar')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe call it jar_version to make it clear what it is (Camelcase dosn't work with click by the way)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's called jar everywhere in erna. If we want to change this, not in this PR


database.init(**config['processing_database'])

jar = Jar.select(Jar.id, Jar.version).where(Jar.version == jar).get()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe pack this and the two below, in some nice try blocks with excepting DoesNotExist to create a nicer usability.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doesnotexist exception is pretty clear i think

xml = XML.get(name=xml, jar=jar)
queue = Queue.get(name=queue)

runs = pd.read_csv(runlist)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what csv files your adding but this call expects 'pandas style' csv files. Meaning it takes the first column as the index, if this is intended it should be explained in the docsting, otherwise fix this call to not do that (index_col=False).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not true. The only requirement is to have the column names in the first row.

queue = Queue.get(name=queue)

runs = pd.read_csv(runlist)
runs['year'] = runs['night'] // 10000
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing this whole night conversation stuff, just to convert it back in the custom field anyways, why not add a isinstance in the NIghtField.db_value function to test if it gets an int and just take it. Would make this whole ordeal a little nicer. Other option is to use the the fact.time.run2dt function of pyfact in the list comprehension like this:

files = [
        RawDataFile.get(night=run2dt(str(row.night)), run_id=row.run_id)
        for row in runs.itertuples()
]

And remove all the calculation of the year, day stuff.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will not change the DB schema for this simple task

@maxnoe maxnoe merged commit 83b4390 into master Mar 1, 2018
@maxnoe maxnoe deleted the submit_runlist branch March 1, 2018 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants