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

Bug fix for turning empty objects into struct #106

Merged
merged 1 commit into from
Feb 21, 2019
Merged

Conversation

k1o0
Copy link
Contributor

@k1o0 k1o0 commented Feb 19, 2019

Mind testing to see if this also resolves the issue with saving the hardware JSON on the zrigs?

@jkbhagatio
Copy link
Member

what was the issue with saving JSON on the zrigs?

@k1o0
Copy link
Contributor Author

k1o0 commented Feb 20, 2019

You mentioned that the hardware JSON wasn't saving on ZRIG4. When a new experiment is started expServer takes the current rig object (loaded from hw.devices) and saves it as a JSON file. This includes the current Git commit that the code is running.

https://github.com/cortex-lab/Rigbox/blob/master/%2Bsrv/expServer.m#L276-L286

    % save a copy of the hardware in JSON
    fid = fopen(dat.expFilePath(expRef, 'hw-info', 'master', 'json'), 'w');
    fprintf(fid, '%s', obj2json(rig));
    fclose(fid);
    if ~strcmp(dat.parseExpRef(expRef), 'default')
      try
        Alyx.registerFile(hwInfo);
      catch ex
        warning(ex.identifier, 'Failed to register hardware info: %s', ex.message);
      end
    end

I don't know what the problem is on ZRIG4 but I recently discovered an error in my obj2struct code that occurs when you try to turn an empty instance of an object into a struct. That's what this fix is for.

@jkbhagatio
Copy link
Member

ah right, will check now

@jkbhagatio jkbhagatio merged commit 53bbb8c into dev Feb 21, 2019
@jkbhagatio
Copy link
Member

You mentioned that the hardware JSON wasn't saving on ZRIG4. When a new experiment is started expServer takes the current rig object (loaded from hw.devices) and saves it as a JSON file. This includes the current Git commit that the code is running.
https://github.com/cortex-lab/Rigbox/blob/master/%2Bsrv/expServer.m#L276-L286

the issue here is simply that the variable 'hwInfo' is undefined

@k1o0
Copy link
Contributor Author

k1o0 commented Feb 21, 2019

the issue here is simply that the variable 'hwInfo' is undefined

That's terrible! How long have the rigs been failing to register the hardware??

@k1o0
Copy link
Contributor Author

k1o0 commented Feb 21, 2019

The answer is Dec 19th. I'm going to have to push a hotfix for this...

@jkbhagatio jkbhagatio deleted the obj2json_fix branch February 21, 2019 19:33
k1o0 pushed a commit that referenced this pull request Jan 3, 2021
Bug fix for turning empty objects into struct
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.

2 participants