@@ -491,78 +491,6 @@ def scale(self, user, structure): # noqa
491491
492492 return False
493493
494- def stop (self , user , types ): # noqa
495- """scale containers which types contained down """
496- rs_zero = []
497- for _ in types :
498- if not self .structure .get (_ , 0 ):
499- rs_zero .append (_ )
500- if rs_zero :
501- raise DryccException ("process {} replicas is zero" .format ("," .join (rs_zero ))) # noqa
502-
503- if self .release_set .filter (failed = False ).latest ().build is None :
504- raise DryccException ('No build associated with this release' )
505-
506- release = self .release_set .filter (failed = False ).latest ()
507- structure = {_ : 0 for _ in types }
508-
509- # test for available process types
510- available_process_types = release .build .procfile or {}
511- for container_type in types :
512- if container_type == 'cmd' :
513- continue # allow docker cmd types in case we don't have the image source
514-
515- if container_type not in available_process_types :
516- raise NotFound (
517- 'Container type {} does not exist in application' .format (container_type ))
518-
519- # merge current structure and the new items together
520- old_structure = self .structure
521- new_structure = old_structure .copy ()
522- new_structure .update (structure )
523-
524- if new_structure != self .structure :
525- try :
526- self ._scale_pods (structure )
527- except ServiceUnavailable :
528- # scaling failed, go back to old scaling numbers
529- self ._scale_pods (old_structure )
530- raise
531-
532- msg = '{} stopped pods ' .format (user .username ) + ' ' .join (types )
533- self .log (msg )
534-
535- return True
536-
537- return False
538-
539- def start (self , user , types ): # noqa
540- """scale containers which types contained up."""
541- # use create to make sure minimum resources are created
542- self .create ()
543- if self .release_set .filter (failed = False ).latest ().build is None :
544- raise DryccException ('No build associated with this release' )
545-
546- rs_zero = []
547- for _ in types :
548- if not self .structure .get (_ , 0 ):
549- rs_zero .append (_ )
550- if rs_zero :
551- raise DryccException ("process {} replicas is zero" .format ("," .join (rs_zero ))) # noqa
552-
553- structure = {}
554- for k , v in self .structure .items ():
555- if k in types :
556- structure [k ] = v
557- try :
558- self ._scale_pods (structure )
559- except ServiceUnavailable :
560- # scaling failed, go back to old scaling numbers
561- raise
562- msg = '{} stopped pods ' .format (user .username ) + ' ' .join (types )
563- self .log (msg )
564- return True
565-
566494 def _scale_pods (self , scale_types ):
567495 release = self .release_set .filter (failed = False ).latest ()
568496 app_settings = self .appsettings_set .latest ()
@@ -910,7 +838,6 @@ def pod_name(size=5, chars=string.ascii_lowercase + string.digits):
910838
911839 def list_pods (self , * args , ** kwargs ):
912840 """Used to list basic information about pods running for a given application"""
913- autoscale = self .appsettings_set .latest ().autoscale
914841 try :
915842 labels = self ._scheduler_filter (** kwargs )
916843
@@ -947,18 +874,16 @@ def list_pods(self, *args, **kwargs):
947874 if 'startTime' in p ['status' ]:
948875 started = p ['status' ]['startTime' ]
949876 else :
950- started = str (datetime .utcnow ().strftime (settings .DRYCC_DATETIME_FORMAT ))
877+ started = str (datetime .utcnow ().strftime (settings .DEIS_DATETIME_FORMAT ))
951878 item ['started' ] = started
952- replicas = str (autoscale [labels ['type' ]]['min' ]) + '-' + str (autoscale [labels ['type' ]]['max' ]) \
953- if autoscale .get (labels ['type' ]) is not None else self .structure .get (labels ['type' ]) # noqa
954- item ['replicas' ] = str (replicas )
879+
955880 data .append (item )
956881
957882 # sorting so latest start date is first
958883 data .sort (key = lambda x : x ['started' ], reverse = True )
959884 return data
960- except KubeHTTPException as e :
961- logger . debug ( e )
885+ except KubeHTTPException :
886+ pass
962887 except Exception as e :
963888 err = '(list pods): {}' .format (e )
964889 self .log (err , logging .ERROR )
0 commit comments