-
Notifications
You must be signed in to change notification settings - Fork 46
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
Db export, again #88
Db export, again #88
Conversation
201e97f
to
182b5cb
Compare
Current coverage is 27.93% (diff: 2.63%)@@ master #88 diff @@
==========================================
Files 6 6
Lines 661 691 +30
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
- Hits 538 193 -345
- Misses 123 498 +375
Partials 0 0
|
This may be ready. It could use a careful read from more than one reviewer. As you can see, the outline for copying external files is here, but not finished. (The docs include warning about that.) I'd like to roll this out as is and handle the external files piece in a second pass. |
res['resource_path'], | ||
res['resource_kwargs'], | ||
root=new_root) | ||
# FIXME: revisit root when dealing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new_root is the root place where the external data file is going to transferred? So basically we can transfer data between different servers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
@licode Yes, that is the plan. As written so far, this only copies database documents between servers. A future iteration will make use of the new_root argument to copy files as well. |
Got it. thanks. |
How would that work? Get Outlook for iOShttps://aka.ms/o0ukef On Thu, Sep 15, 2016 at 3:52 PM -0400, "Li Li" <notifications@github.commailto:notifications@github.com> wrote: Got it. thanks. — |
I think I oversimplify the issue. Please ignore that. |
👍 This looks good to me |
db.fs.insert_resource(res['spec'], | ||
res['resource_path'], | ||
res['resource_kwargs'], | ||
root=new_root) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should pass through res['root']
until this is actually implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to anyone following along: this is now actually implemented.
headers = [headers] | ||
for header in headers: | ||
# insert mds | ||
db.mds.insert_run_start(**_clean_doct(header['start'])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and by 'this' I mean _clean_doct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because a doct has a _name attribute hanging off of it that gets unpacked in insert_run_start.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am pretty sure we should get rid of '_name' -- an artifact of mongoengine documents -- but that's a question for another day.
@@ -799,3 +855,10 @@ def _munge_time(t, timezone): | |||
""" | |||
t = datetime.fromtimestamp(t) | |||
return timezone.localize(t).replace(microsecond=0).isoformat() | |||
|
|||
|
|||
def _clean_doct(d): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a function in doct for doing this splitting.
follow instruction on github and reference function signature
need to be reviewd and figure out exact input object
also update docstring and code acoordingly
050d8a3
to
b769736
Compare
This is close, but it requires a |
If NSLS-II/filestore#121 is merged, this PR should just work. But I don't want to run roughshod over any concerns @tacaswell may have here, so please do not merge unless you are @tacaswell. :- ) |
173b54d
to
7b524a6
Compare
@@ -190,7 +191,7 @@ def get_events(mds, fs, headers, fields=None, stream_name=ALL, fill=False, | |||
# Look in the descriptor, then start, then stop. | |||
config_data_fields = set(filter(comp_re.match, config_data)) - selected_fields | |||
for field in config_data_fields: | |||
selected_fields.append(field) | |||
selected_fields.add(field) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is an unrelated bug fix.
Note to whoever has the patience to finish this someday: |
res['resource_path'], | ||
res['resource_kwargs'], | ||
root=new_root) | ||
datums = self.fs.datum_gen_given_resource(uid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NSLS-II/filestore#122 will make this method,datum_gen_given_resource
, return the full datum document (including the ID which we need) instead of just the datum kwargs.
Test passes locally and should pass here once NSLS-II/filestore#122 and bluesky/bluesky#612 are in. Phew. |
Not wanting to feel left out I added a commit to this PR too! |
Test failure is unrelated to this PR but probably real. I'll open a separate issue and expand on that. Seeing @tacaswell's marked approval above, and knowing that three of us have code in here, I guess I'll be the one to pull the trigger.... |
""" | ||
Export a list of headers. | ||
|
||
.. warning:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this warning still apply?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not
This is a rebase of #76 with some extra commits to add a test and make it pass.