コード例 #1
0
  def __init__(self,workflow):
    super(AllocateStep,self).__init__(workflow)
#    contributes=['name','description','login']
    contributes=['name']
    request=self.workflow.request
    hardwares=trinity.hardwares_list(request)
    for hardware in hardwares:
      contributes.append(hardware)
    self.contributes=tuple(contributes)
コード例 #2
0
ファイル: workflows.py プロジェクト: rispoli/trinity
 def __init__(self, workflow):
     super(AllocateStep, self).__init__(workflow)
     #    contributes=['name','description','login']
     contributes = ["name"]
     request = self.workflow.request
     hardwares = trinity.hardwares_list(request)
     for hardware in hardwares:
         contributes.append(hardware)
     self.contributes = tuple(contributes)
コード例 #3
0
 def get_columns(self):
   request=self.request
   hardwares=trinity.hardwares_list(self.request)
   columns_unsorted=[]
   cluster=tables.Column('cluster', verbose_name=_(' '))
   cluster.table=self
   columns_unsorted.append(('cluster',cluster))
   status=tables.Column('status', verbose_name=_('Status'))
   status.table=self
   columns_unsorted.append(('status',status))
   for hardware in hardwares:
     key=hardware
     value=tables.Column(hardware, verbose_name=_(hardware), summation='sum')
     value.table=self
     columns_unsorted.append((key,value))
   for key, value in self.columns.items():
     columns_unsorted.append((key,value))
   self.columns=SortedDict(columns_unsorted)
   return self.columns.values() 
コード例 #4
0
  def  __init__(self,request, context,*args, **kwargs):
    super(AllocateAction,self).__init__(request, context,*args, **kwargs) 
    hardwares=trinity.hardwares_list(request)
    cluster=self.initial['cluster']
    field        = forms.CharField   (label=_("Name of the cluster"),
                         required=True, initial=cluster)
    self.fields.update({'name':field})
    cluster_hardware=trinity.cluster_hardware(request,cluster)
    hardwares_detail=trinity.hardwares_detail(request)
    for hardware in hardwares:
      for datum in hardwares_detail:
        if datum["hardware"]==hardware:
          max_value=datum["total"]-datum["used"]
          break

      initial_nodes=0
      for datum in cluster_hardware:
        if datum.type==hardware:
          initial_nodes=datum.amount
          max_value=max_value+initial_nodes
          break
      field =  forms.IntegerField(label=_("Number of "+hardware+" nodes"),
                         min_value=0,max_value=max_value,initial=initial_nodes)
      self.fields.update({hardware:field})
コード例 #5
0
ファイル: workflows.py プロジェクト: rispoli/trinity
    def __init__(self, request, context, *args, **kwargs):
        super(AllocateAction, self).__init__(request, context, *args, **kwargs)
        hardwares = trinity.hardwares_list(request)
        cluster = self.initial["cluster"]
        field = forms.CharField(label=_("Name of the cluster"), required=True, initial=cluster)
        self.fields.update({"name": field})
        cluster_hardware = trinity.cluster_hardware(request, cluster)
        hardwares_detail = trinity.hardwares_detail(request)
        for hardware in hardwares:
            for datum in hardwares_detail:
                if datum["hardware"] == hardware:
                    max_value = datum["total"] - datum["used"]
                    break

            initial_nodes = 0
            for datum in cluster_hardware:
                if datum.type == hardware:
                    initial_nodes = datum.amount
                    max_value = max_value + initial_nodes
                    break
            field = forms.IntegerField(
                label=_("Number of " + hardware + " nodes"), min_value=0, max_value=max_value, initial=initial_nodes
            )
            self.fields.update({hardware: field})