-
Notifications
You must be signed in to change notification settings - Fork 39
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
add 06-distributed-computing_jobs_by_key.rst (#259) #346
base: stage
Are you sure you want to change the base?
Changes from all commits
04db413
31d8a41
1c88600
2463271
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
% dj.key_hash - key hashing function for populate jobs, etc | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we are adding to the code base, would you add a minimal test for taking the hash to maintain the coverage? Also, would you remove this and add it properly in the function so that it works with |
||
|
||
function s = key_hash(key) | ||
s = dj.internal.hash(key); | ||
s = s(1:32); | ||
end | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,37 @@ | ||||||
|
||||||
This can be done by using `dj.internal.hash` to convert the key as follows: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
.. code-block:: matlab | ||||||
|
||||||
> job_key = struct('table_name', 'Lab.SessionAnalysis', ... | ||||||
'key_hash', dj.key_hash(key)); | ||||||
> Lab.Jobs() & job_key | ||||||
|
||||||
|
||||||
ans = | ||||||
|
||||||
|
||||||
Object Lab.Jobs | ||||||
|
||||||
:: the job reservation table for +Lab :: | ||||||
|
||||||
TABLE_NAME KEY_HASH status error_message user host pid connection_id timestamp key error_stack | ||||||
_______________________ ____________________________________ ____________ _____________ ________ _________ __________ _____________ _______________________ __________ ___________ | ||||||
|
||||||
{'Lab.SessionAnalysis'} {'jA9sN_5PvusWwmznLGcAZbTn5pGtba-z'} {'error'} {0×0 char} {'datajoint@localhost'} {'localhost'} 6.5356e+05 1919 {'2021-01-22 23:50:07'} {'=BLOB='} {'=BLOB='} | ||||||
|
||||||
1 tuples (0.127 s) | ||||||
|
||||||
> del(Lab.Jobs() & job_key; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
> Lab.Jobs() & job_key | ||||||
|
||||||
ans = | ||||||
|
||||||
|
||||||
Object Lab.Jobs | ||||||
|
||||||
:: the job reservation table for +Lab :: | ||||||
|
||||||
0 tuples (0.0309 s) | ||||||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -12,7 +12,7 @@ function makeTuples(self,key) | |||
r = sprintf('connection_id = %d', c.serverId); | ||||
|
||||
j = fetch(Lab.Jobs() & r, '*'); | ||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like whitespace was added by mistake...
Suggested change
|
||||
if isempty(j) | ||||
key.session_analysis = key.session_id; | ||||
else | ||||
|
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.
Actually, to access it properly you should indicate the package as well: