CampbellGroup / common

Shared campbell lab code.
GNU Lesser General Public License v3.0
8 stars 5 forks source link

simplify script scanner config to just a path to experiments #226

Open jayich opened 6 years ago

jayich commented 6 years ago

Have script scanner look in a directory and subdirectories for experiments. Experiments should automatically load into script scanner based on a variable in the experiment.py file, similar to how labrad finds servers.

fanmingyu212 commented 6 years ago

@aransfor I am working on this issue on https://github.com/CampbellGroup/common/tree/mf/228_script_scanner_enhancements. The syntax for the docstring of the experiments to be loaded in script scanner is:

'''
### BEGIN EXPERIMENT INFO
[info]
name = AOMPowerCalibration
load_into_scriptscanner = False
### END EXPERIMENT INFO
'''

I think this docstring has to be added at the beginning of the experiment. name is the class name in the experiment module you want to load, and load_into_scriptscanner is a boolean value deciding whether the experiment should be loaded.

The new scriptscanner_config.py will look like,

class config(object):
    scripts = []
    paths = ["pydux.lib.control.experiments"]
    allowed_concurrent = {}
    launch_history = 1000

scripts is now an empty list that I am going to eliminate later. paths is a list that saves the paths that script scanner will try to look for experiments.

As long as the experiment is in paths, name in the experiment docstring is correct, and load_into_scriptscanner is set to True, the script scanner should load the experiment.

aransfor commented 6 years ago

Is it possible to make the headline #!scriptscanner and that is it? I want to avoid spelling errors of which I make a lot. If it was just that one line I would delete it if I didnt want it to show up

aransfor commented 6 years ago

Also I think we can eliminate the config all together and just store the path in the registry the way datavault does

aransfor commented 6 years ago

BTW this looks awesome, I have wanted this for a long time

fanmingyu212 commented 6 years ago

@aransfor The script scanner needs to know which class in an experiment module to look for if there are multiple classes in an experiment. Therefore, I think we cannot reduce the docstring to only a headline. Also, I want to follow the docstring format of how labrad web manager finds servers.

You can copy the same docstring to different experiments and only change the name variable and potentially change load_into_scriptscanner.

I think eliminating the config and moving to registry is a good idea.

aransfor commented 6 years ago

@fanmingyu212 I suppose I agree. I would only suggest two things then, At least for the time being SS should be backward compatible with the config file and also the allowed concurrent should be an optional tag in the experiment header not the config/registry. Also perhaps an 'allow all' argument should be added while your deep in this