Skip to content

Comments

Replaced python calls with json#346

Merged
vshekar merged 8 commits intoNSLS2:masterfrom
vshekar:jsonize-server-comm
Nov 21, 2023
Merged

Replaced python calls with json#346
vshekar merged 8 commits intoNSLS2:masterfrom
vshekar:jsonize-server-comm

Conversation

@vshekar
Copy link
Collaborator

@vshekar vshekar commented Nov 13, 2023

Added a mechanism to replace exec and function calls with a structured json that can only execute functions in a whitelist

@vshekar
Copy link
Collaborator Author

vshekar commented Nov 13, 2023

Will force push without the code formatting, as there are too many changes to review

Copy link
Collaborator

@JunAishima JunAishima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, looks good. There are also a few other positive aspects:

  • A lot of args/kwargs preserve numerical type, if the value isn't coming from a GUI text box
  • Get rid of a fair bit of ugly old-style string assembly, before f strings
  • generate_server_message() is well-composed to handle command, args, kwargs to allow full flexibility of calls as with the previous method
  • no ispybLib commands are on the whitelist, except for the insertRasterResult() so it shouldn't be possible to do the full cycle of adding yourself to a different proposal. you probably could add your collection to another experiment, but that won't be too useful (but would need to reverse-engineer all of the information in the collection request to do so)
  • Do you think we could just extract the send_to_server() function so that one function will be called to generate the message, log, then send to the appropriate queue?

Copy link
Collaborator

@JunAishima JunAishima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just want some more explanation for why the generate_server_message() needed to be brought into the ControlMain class

@vshekar vshekar merged commit 6d644da into NSLS2:master Nov 21, 2023
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.

3 participants