Ejemplo n.º 1
0
 def _parse_job_info_args(self, args):
     self.trainjob_name = args['job_name']
     self.trainjob_memo = parse_unrequired_args('job_memo', args)
     self.business_group = parse_unrequired_args('business_group', args)
     self.max_exec_time = args['max_exec_time']
     if self.max_exec_time <= 0:
         raise ValueError("Parameter max_exec_time should be larger than 0")
     self.dist_ai_frame = parse_unrequired_args('dist_ai_frame', args)
Ejemplo n.º 2
0
 def _parse_service_args(self, args):
     self.service_id = parse_unrequired_args('service_id', args)
     self.offset = parse_unrequired_args('offset', args)
     self.limit = parse_unrequired_args('limit', args)
     if int(self.limit) < 0:
         raise ValueError(
             'Limit should be positive, current limit: {0}'.format(
                 self.limit))
     if int(self.offset) < 0:
         raise ValueError(
             'Offset should be positive, current offset: {0}'.format(
                 self.offset))
Ejemplo n.º 3
0
    def _parse_docker_deploy_args(self, args):
        self.service_id = args['service_id']
        self.uimg_name = args['uimg_name']
        self.deploy_weight = args['deploy_weight']
        if int(self.deploy_weight) not in range(1, 100):
            raise ValueError(
                'Deploy weight should be int within 1 and 100, current deploy weight: {0}'
                .format(self.deploy_weight))

        self.srv_version_memo = parse_unrequired_args('srv_version_memo', args)
Ejemplo n.º 4
0
 def _parse_create_args(self, args):
     self.service_name = args['service_name']
     if 'gpu' in args and args['gpu'] != None:
         self.gpu = args['gpu']
         self.cpu = parse_unrequired_args('cpu', args)
         self.memory = parse_unrequired_args('memory', args)
     elif ('cpu' in args
           and args['cpu'] != None) and ('memory' in args
                                         and args['memory'] != None):
         self.gpu = parse_unrequired_args('gpu', args)
         self.cpu = args['cpu']
         self.memory = args['memory']
         if self.cpu != self.memory:
             raise ValueError(
                 'Value of "cpu" and "memory" should be equal when creating elastic services, Current cpu:{0} memory:{1}'
                 .format(self.cpu, self.memory))
     else:
         raise ValueError(
             'Parameters "cpu, memory" and "gpu" should not be nil at same time.'
         )
     self.business_group = parse_unrequired_args('business_group', args)
Ejemplo n.º 5
0
    def _parse_deploy_args(self, args):
        self.service_id = args['service_id']
        if 'bimg_name' in args and args['bimg_name'] != None:
            self.bimg_name = args['bimg_name']
            self.os_version = parse_unrequired_args('os', args)
            self.python_version = parse_unrequired_args('language', args)
            self.ai_arch_v = parse_unrequired_args('ai_arch_v', args)
        elif ('os' in args and args['os'] != None) and (
                'language' in args and args['language'] != None) and (
                    'ai_arch_v' in args and args['ai_arch_v'] != None):
            self.os_version = args['os']
            self.python_version = args['language']
            self.ai_arch_v = args['ai_arch_v']
            self.bimg_name = parse_unrequired_args('bimg_name', args)
        else:
            raise ValueError(
                'Parameters "os, language, ai_arch_v" and "bimg_name" should not be nil at same time.'
            )

        self.ufile_url = args['ufile_url']
        self.os_deps = parse_unrequired_args('os_deps', args)
        self.pip = parse_unrequired_args('pip', args)
Ejemplo n.º 6
0
 def _parse_stop_args(self, args):
     self.service_id = args['service_id']
     self.srv_version = parse_unrequired_args('srv_version', args)
Ejemplo n.º 7
0
 def _parse_account_args(self, args):
     self.public_key = args['public_key']
     self.private_key = args['private_key']
     self.project_id = parse_unrequired_args('project_id', args)
     self.region = parse_unrequired_args('region', args)
     self.zone = parse_unrequired_args('zone', args)