@@ -200,36 +200,35 @@ def create_simulators(filein,instance='',path='',domains={},tango_host='controls
200
200
print ('>' * 80 )
201
201
202
202
for d ,t in sorted (devs .items ()):
203
- klass = 'PyStateComposer' if t .dev_class == 'PyStateComposer' else 'PySignalSimulator'
204
- server = 'DynamicServer'
205
- print (('%s/%s' % (server ,instance ),server ,d ))
203
+ t .dev_class = t .dev_class or d .split ('/' )[- 1 ]
204
+ klass = 'PyStateComposer' if t .dev_class == 'PyStateComposer' else 'SimulatorDS'
205
+ server = 'DynamicDS'
206
+ print (('%s/%s' % (server ,instance + '-' + t .dev_class ),server ,d ))
206
207
its_new = ('/' .join (('dserver' ,server ,instance ))).lower () not in all_devs or d .lower () not in all_devs
207
- if its_new :
208
- print ('creating ...' )
209
- fandango .tango .add_new_device ('%s/%s' % (server ,instance ),klass ,d )
210
208
211
209
if its_new or override :
210
+ print ('writing ... %s(%s)' % (type (t ),d ))
211
+ fandango .tango .add_new_device ('%s/%s-%s' % (server ,instance ,t .dev_class ),klass ,d )
212
212
for p ,v in t .props .items ():
213
213
if not p .startswith ('__' ): #p not in ('DynamicCommands','DynamicStates','LoadFromFile','DevicesList') and
214
214
fandango .tango .put_device_property (d ,p ,v )
215
215
#Overriding Dynamic* properties
216
216
try :
217
217
fandango .tango .put_device_property (d ,'LoadFromFile' ,path + '%s_attributes.txt' % t .dev_class )
218
- except : traceback .print_exc ()
219
- try :
220
218
fandango .tango .put_device_property (d ,'DynamicAttributes' ,filter (bool ,map (str .strip ,open (path + '%s_attributes.txt' % t .dev_class ).readlines ())))
221
- except : traceback .print_exc ()
222
- try :
223
219
fandango .tango .put_device_property (d ,'DynamicCommands' ,filter (bool ,map (str .strip ,open (path + '%s_commands.txt' % t .dev_class ).readlines ())))
224
- except : traceback .print_exc ()
225
- try :
226
220
fandango .tango .put_device_property (d ,'DynamicStates' ,filter (bool ,map (str .strip ,open (path + '%s_states.txt' % t .dev_class ).readlines ())))
227
- except : traceback .print_exc ()
221
+ except :
222
+ print ('Unable to configure %s(%s) properties ' % (d ,t .dev_class ))
223
+ #traceback.print_exc()
228
224
229
225
fandango .tango .put_device_property (d ,'OFFSET' ,random .randint (0 ,len (devs )))
230
226
done .append (d )
231
227
228
+ exported = fandango .get_all_devices (exported = True )
229
+ print ('Checking Devices ...' )
232
230
for d in done :
231
+ if d not in exported : continue
233
232
if fandango .check_device (d ):
234
233
print ('Updating %s ...' % d )
235
234
try : fandango .get_device (d ).updateDynamicAttributes ()
@@ -241,7 +240,7 @@ def create_simulators(filein,instance='',path='',domains={},tango_host='controls
241
240
def run_dynamic_server (instance ):
242
241
print ('run_dynamic_server:' + str (instance ))
243
242
from fandango .dynamic import DynamicServer
244
- sys .argv = ['DynamicServer .py' ,instance ,'-v2' ]
243
+ sys .argv = ['DynamicDS .py' ,instance ,'-v2' ]
245
244
print (sys .argv )
246
245
pyds = DynamicServer (add_debug = False )
247
246
pyds .main ()
@@ -272,7 +271,7 @@ def set_push_events(filein,period=3000,diff=1e-5):
272
271
def delete_simulators (filein ):
273
272
#NOTE THIS METHOD SHOUL DELETE ONLY PYSIGNALSIMULATOR INSTANCES, NOT ANYTHING ELSE!
274
273
raise 'NotImplementedYet!'
275
- all_sims = fandango .Astor ('Py *Simulator/*' ).get_all_devices ()
274
+ all_sims = fandango .Astor ('*Simulator* /*' ).get_all_devices ()
276
275
devs = [d for d in pickle .load (open (filein )) if d in all_sims ]
277
276
db = PyTango .Database ()
278
277
for d in devs :
@@ -321,4 +320,4 @@ def main(args):
321
320
import sys
322
321
args = sys .argv [1 :]
323
322
main (args )
324
-
323
+
0 commit comments