@@ -287,23 +287,19 @@ def addGraphSpec(self, graphSpec):
287
287
self .status = SessionStates .BUILDING
288
288
289
289
# This will check the consistency of each dropSpec
290
- logger .debug ("Trying to add graphSpec: %s" , [[x ['oid' ],x ['node' ]] for x in graphSpec ])
291
- graphSpecDict , self ._graphreprodata = graph_loader .loadDropSpecs (
292
- graphSpec
293
- )
290
+ # logger.debug("Trying to add graphSpec: %s", [x.keys() for x in graphSpec])
291
+ logger .debug ("Trying to add graphSpec: %s" , graphSpec )
292
+ graphSpecDict , self ._graphreprodata = graph_loader .loadDropSpecs (graphSpec )
294
293
# Check for duplicates
295
294
duplicates = set (graphSpecDict ) & set (self ._graph )
296
295
if duplicates :
297
296
raise InvalidGraphException (
298
- "Trying to add drops with OIDs that already exist: %r"
299
- % (duplicates ,)
297
+ "Trying to add drops with OIDs that already exist: %r" % (duplicates ,)
300
298
)
301
299
302
300
self ._graph .update (graphSpecDict )
303
301
304
- logger .debug (
305
- "Added a graph definition with %d DROPs" , len (graphSpecDict )
306
- )
302
+ logger .debug ("Added a graph definition with %d DROPs" , len (graphSpecDict ))
307
303
308
304
@track_current_session
309
305
def linkGraphParts (self , lhOID , rhOID , linkType , force = False ):
@@ -329,9 +325,7 @@ def linkGraphParts(self, lhOID, rhOID, linkType, force=False):
329
325
missingOids .append (rhOID )
330
326
if missingOids :
331
327
oids = "OID" if len (missingOids ) == 1 else "OIDs"
332
- raise InvalidGraphException (
333
- "No DROP found for %s %r" % (oids , missingOids )
334
- )
328
+ raise InvalidGraphException ("No DROP found for %s %r" % (oids , missingOids ))
335
329
336
330
graph_loader .addLink (linkType , lhDropSpec , rhOID , force = force )
337
331
@@ -356,8 +350,7 @@ def deploy(self, completedDrops=[], event_listeners=[], foreach=None):
356
350
not self ._graph and status != SessionStates .PRISTINE
357
351
):
358
352
raise InvalidSessionState (
359
- "Can't deploy this session in its current status: %d"
360
- % (status )
353
+ "Can't deploy this session in its current status: %d" % (status )
361
354
)
362
355
363
356
if not self ._graph and completedDrops :
@@ -468,9 +461,7 @@ def _run(self, worker):
468
461
def trigger_drops (self , uids ):
469
462
for drop , downStreamDrops in droputils .breadFirstTraverse (self ._roots ):
470
463
downStreamDrops [:] = [
471
- dsDrop
472
- for dsDrop in downStreamDrops
473
- if isinstance (dsDrop , AbstractDROP )
464
+ dsDrop for dsDrop in downStreamDrops if isinstance (dsDrop , AbstractDROP )
474
465
]
475
466
if drop .uid in uids :
476
467
if isinstance (drop , InputFiredAppDROP ):
@@ -547,9 +538,7 @@ def add_node_subscriptions(self, relationships):
547
538
remote_uid = rel .rhs
548
539
mname = LINKTYPE_1TON_BACK_APPEND_METHOD [rel .rel ]
549
540
550
- self ._proxyinfo .append (
551
- (host , rpc_port , local_uid , mname , remote_uid )
552
- )
541
+ self ._proxyinfo .append ((host , rpc_port , local_uid , mname , remote_uid ))
553
542
554
543
def append_reprodata (self , oid , reprodata ):
555
544
if oid in self ._graph :
@@ -561,30 +550,26 @@ def append_reprodata(self, oid, reprodata):
561
550
drop_reprodata = reprodata .get ("data" , {})
562
551
drop_hashes = reprodata .get ("merkleroot" , {})
563
552
for rmode in ALL_RMODES :
564
- self ._graph [oid ]["reprodata" ][rmode .name ][
565
- "rg_data"
566
- ] = drop_reprodata [ rmode . name ]
553
+ self ._graph [oid ]["reprodata" ][rmode .name ]["rg_data" ] = (
554
+ drop_reprodata [ rmode . name ]
555
+ )
567
556
self ._graph [oid ]["reprodata" ][rmode .name ]["rg_data" ][
568
557
"merkleroot"
569
558
] = drop_hashes .get (rmode .name , b"" )
570
559
571
560
else :
572
- self ._graph [oid ]["reprodata" ]["rg_data" ] = reprodata .get (
573
- "data" , {}
561
+ self ._graph [oid ]["reprodata" ]["rg_data" ] = reprodata .get ("data" , {})
562
+ self ._graph [oid ]["reprodata" ]["rg_data" ]["merkleroot" ] = reprodata .get (
563
+ "merkleroot" , b""
574
564
)
575
- self ._graph [oid ]["reprodata" ]["rg_data" ][
576
- "merkleroot"
577
- ] = reprodata .get ("merkleroot" , b"" )
578
565
579
566
@track_current_session
580
567
def finish (self ):
581
568
self .status = SessionStates .FINISHED
582
569
logger .info ("Session %s finished" , self ._sessionId )
583
570
for drop , downStreamDrops in droputils .breadFirstTraverse (self ._roots ):
584
571
downStreamDrops [:] = [
585
- dsDrop
586
- for dsDrop in downStreamDrops
587
- if isinstance (dsDrop , AbstractDROP )
572
+ dsDrop for dsDrop in downStreamDrops if isinstance (dsDrop , AbstractDROP )
588
573
]
589
574
if drop .status in (DROPStates .INITIALIZED , DROPStates .WRITING ):
590
575
drop .setCompleted ()
@@ -595,9 +580,7 @@ def end(self):
595
580
logger .info ("Session %s ended" , self ._sessionId )
596
581
for drop , downStreamDrops in droputils .breadFirstTraverse (self ._roots ):
597
582
downStreamDrops [:] = [
598
- dsDrop
599
- for dsDrop in downStreamDrops
600
- if isinstance (dsDrop , AbstractDROP )
583
+ dsDrop for dsDrop in downStreamDrops if isinstance (dsDrop , AbstractDROP )
601
584
]
602
585
if drop .status in (DROPStates .INITIALIZED , DROPStates .WRITING ):
603
586
drop .skip ()
@@ -621,9 +604,7 @@ def getGraphStatus(self):
621
604
statusDict = collections .defaultdict (dict )
622
605
for drop , downStreamDrops in droputils .breadFirstTraverse (self ._roots ):
623
606
downStreamDrops [:] = [
624
- dsDrop
625
- for dsDrop in downStreamDrops
626
- if isinstance (dsDrop , AbstractDROP )
607
+ dsDrop for dsDrop in downStreamDrops if isinstance (dsDrop , AbstractDROP )
627
608
]
628
609
if isinstance (drop , AppDROP ):
629
610
statusDict [drop .oid ]["execStatus" ] = drop .execStatus
@@ -636,14 +617,11 @@ def cancel(self):
636
617
status = self .status
637
618
if status != SessionStates .RUNNING :
638
619
raise InvalidSessionState (
639
- "Can't cancel this session in its current status: %d"
640
- % (status )
620
+ "Can't cancel this session in its current status: %d" % (status )
641
621
)
642
622
for drop , downStreamDrops in droputils .breadFirstTraverse (self ._roots ):
643
623
downStreamDrops [:] = [
644
- dsDrop
645
- for dsDrop in downStreamDrops
646
- if isinstance (dsDrop , AbstractDROP )
624
+ dsDrop for dsDrop in downStreamDrops if isinstance (dsDrop , AbstractDROP )
647
625
]
648
626
if drop .status not in (
649
627
DROPStates .ERROR ,
@@ -682,9 +660,7 @@ def get_drop_property(self, uid, prop_name):
682
660
drop = self ._drops [uid ]
683
661
return getattr (drop , prop_name )
684
662
except AttributeError :
685
- raise DaliugeException (
686
- "%r has no property called %s" % (drop , prop_name )
687
- )
663
+ raise DaliugeException ("%r has no property called %s" % (drop , prop_name ))
688
664
689
665
def call_drop (self , uid , method , * args ):
690
666
if uid not in self ._drops :
@@ -693,9 +669,7 @@ def call_drop(self, uid, method, *args):
693
669
drop = self ._drops [uid ]
694
670
m = getattr (drop , method )
695
671
except AttributeError :
696
- raise DaliugeException (
697
- "%r has no method called %s" % (drop , method )
698
- )
672
+ raise DaliugeException ("%r has no method called %s" % (drop , method ))
699
673
return m (* args )
700
674
701
675
# Support for the 'with' keyword
0 commit comments