Code Monkey home page Code Monkey logo

Comments (9)

ZryletTC avatar ZryletTC commented on August 29, 2024 1

It appears to be an issue with a way that we used to create happi entries. I've created a couple test devices and it seems nowadays the 'id' is set to the 'name', but looking through the database, there a ton of entries where it looks like the ids came from the devices' prefixes. We should probably transition those over...

from device_config.

klauer avatar klauer commented on August 29, 2024 1

OK, I think we should go through these and change it up. Will wait til Zach gets back, though, just in case something is relying on these IDs that we're not aware of.

from device_config.

ZLLentz avatar ZLLentz commented on August 29, 2024

Nothing is relying on the old ID formulation as far as I know. All applications I'm aware of are doing broader searches rather than using hard-coded names.

The original idea was that no two devices would ever have the same PV, thus it was the static, unique identifier. In practice it was easier to access devices by their shorter name fields.

from device_config.

klauer avatar klauer commented on August 29, 2024

This actually came up as a point of confusion from LBNL no more than a couple hours after I had submitted the issue.
Both NSLS-II and LBNL wanted to bypass the CLI and directly write JSON, interestingly enough.

That's a fair point about the PV names being unique; name clashes from hutch-to-hutch do seem possible. If we're all OK enforcing a globally-unique name for every device in the database, we should move forward with switching up the IDs.

from device_config.

ZLLentz avatar ZLLentz commented on August 29, 2024

I'm 👍 on switching the IDs. If you want to avoid name collisions, put your hutch in the name.

I'm not super surprised that people want to bypass the CLI and the IPython interface, but this isn't a good idea in general because the tools exist to help you create a working database. This implies that both of these interfaces need to be improved.

from device_config.

ZryletTC avatar ZryletTC commented on August 29, 2024

I'm 👍 on moving forward with the changes

from device_config.

ZryletTC avatar ZryletTC commented on August 29, 2024

And actually, it looks like we don't have any name conflicts :)

In [22]: with open('/Users/pennebak/Documents/GitHub/device_config/db.json') as infile: 
    ...:     db = json.load(infile) 
    ...:                                                                                            

In [23]: newdb = {}                                                                                 

In [24]: for key in db: 
    ...:     for newkey in newdb: 
    ...:         if db[key]['name'] == newdb[newkey]['name']: 
    ...:             print(f'{key} = {newkey}') 
    ...:         else: 
    ...:             #print(f'{key} is good') 
    ...:             pass 
    ...:     newdb[key] = db[key] 
    ...:                                                                                            

In [25]: db['XRT:M1H']['name']                                                                      
Out[25]: 'xrt_m1h'

from device_config.

klauer avatar klauer commented on August 29, 2024

Awesome!

from device_config.

klauer avatar klauer commented on August 29, 2024

Closed by #14

from device_config.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.