Submit runlist#54
Conversation
|
|
||
| @click.command() | ||
| @click.argument('runlist') | ||
| @click.argument('jar') |
There was a problem hiding this comment.
maybe call it jar_version to make it clear what it is (Camelcase dosn't work with click by the way)
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
Maybe pack this and the two below, in some nice try blocks with excepting DoesNotExist to create a nicer usability.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I will not change the DB schema for this simple task
No description provided.