data: it has three keys: trial_job_id, event, hyper_params
             - trial_job_id: the id generated by training service
             - event: the job's state
             - hyper_params: the hyperparameters generated and returned by tuner
553037
def handle_trial_end(self, data):
        
        trial_job_id = data['trial_job_id']
        _ended_trials.add(trial_job_id)
        if trial_job_id in _trial_history:
            _trial_history.pop(trial_job_id)
            if self.assessor is not None:
                self.assessor.trial_end(trial_job_id, data['event'] == 'SUCCEEDED')
        if self.tuner is not None:
            self.tuner.trial_end(json_tricks.loads(data['hyper_params'])['parameter_id'], data['event'] == 'SUCCEEDED')
196770
def describe_cluster(jobflow_id)
      params = {
        :operation => 'DescribeCluster',
        :cluster_id => jobflow_id,
      }
      aws_result = @aws_request.submit(params)
      yield aws_result if block_given?
      JSON.parse(aws_result)
    end
255446
def generate_parameters(self, parameter_id):
        
        if self.first_one:
            init_challenger = self.smbo_solver.nni_smac_start()
            self.total_data[parameter_id] = init_challenger
            return self.convert_loguniform_categorical(init_challenger.get_dictionary())
        else:
            challengers = self.smbo_solver.nni_smac_request_challengers()
            for challenger in challengers:
                self.total_data[parameter_id] = challenger
                return self.convert_loguniform_categorical(challenger.get_dictionary())
754620
def GetBatchJob(client, batch_job_id):
  
  batch_job_service = client.GetService('BatchJobService', 'v201809')

  selector = {
      'fields': ['Id', 'Status', 'DownloadUrl'],
      'predicates': [
          {
              'field': 'Id',
              'operator': 'EQUALS',
              'values': [batch_job_id]
          }
      ]
  }

  return batch_job_service.get(selector)['entries'][0]
269712
def process_params(self, params):
        '''
        
        '''
        for key, val in params.items():
            if key in LAUNCH_DATA_PARAMETERS and val != 'None':
                if key == 'roles':
                    if isinstance(val, list):
                        # If it's already a list, no need to parse
                        self.roles = list(val)
                    else:
                        # If it's a ',' delimited string, split
                        self.roles = val.split(',')
                else:
                    setattr(self, key, touni(val))
            elif 'custom_' in key:
                self.custom_params[key] = touni(val)
            elif 'ext_' in key:
                self.ext_params[key] = touni(val)
77123
def to_h
      {
          event_id:   event_id,
          metadata:   metadata.to_h,
          data:       data,
          type:       type,
      }
    end
162251
def _build_trial_meta(cls, expr_dir):
        
        meta_file = os.path.join(expr_dir, EXPR_META_FILE)
        meta = parse_json(meta_file)

        if not meta:
            job_id = expr_dir.split("/")[-2]
            trial_id = expr_dir[-8:]
            params = parse_json(os.path.join(expr_dir, EXPR_PARARM_FILE))
            meta = {
                "trial_id": trial_id,
                "job_id": job_id,
                "status": "RUNNING",
                "type": "TUNE",
                "start_time": os.path.getctime(expr_dir),
                "end_time": None,
                "progress_offset": 0,
                "result_offset": 0,
                "params": params
            }

        if not meta.get("start_time", None):
            meta["start_time"] = os.path.getctime(expr_dir)

        if isinstance(meta["start_time"], float):
            meta["start_time"] = timestamp2date(meta["start_time"])

        if meta.get("end_time", None):
            meta["end_time"] = timestamp2date(meta["end_time"])

        meta["params"] = parse_json(os.path.join(expr_dir, EXPR_PARARM_FILE))

        return meta
821567
def retrieve_data jobName, _options = {}
      # TODO: add support for csv
      endpoint = "http://api.diffbot.com/v3/bulk/download/#{@token}-#{jobName}_data.json"
      JSON.parse(HTTParty.get(endpoint).body).each_pair do |key, value|
        self[key] = value
      end
    end
101568
def id
      params_id_key_candidates.each do |key|
        value = params[key]
        return value if value.present?
      end

      nil
    end
8601
def training_data(self):
        

        data = pickle.load(open(os.path.join(self.repopath, 'training.pkl')))
        return data.keys(), data.values()
266269
def retrieve_job(self, job_id):
        
        warnings.warn('Use results generator method instead of retrieve_job which returns a list', UserWarning)
        return list(self.results(job_id))
427817
def generate_creds_params
      define_singleton_method :creds_params,
        if @service_tokens
          lambda do |options|
            token = options.delete(:service_token)
            service_id = options[:service_id]
            raise ArgumentError, "need to specify a service_token and a service_id" unless token && service_id
            'service_token='.freeze + CGI.escape(token)
          end
        elsif @provider_key
          warn DEPRECATION_MSG_PROVIDER_KEY if @warn_deprecated
          lambda do |_|
            "provider_key=#{CGI.escape @provider_key}".freeze
          end
        else
          raise ArgumentError, 'missing credentials - either use "service_tokens: true" or specify a provider_key value'
        end
    end
215940
def trial_end(self, trial_job_id, success):
        
        if trial_job_id in self.running_history:
            if success:
                cnt = 0
                history_sum = 0
                self.completed_avg_history[trial_job_id] = []
                for each in self.running_history[trial_job_id]:
                    cnt += 1
                    history_sum += each
                    self.completed_avg_history[trial_job_id].append(history_sum / cnt)
            self.running_history.pop(trial_job_id)
        else:
            logger.warning('trial_end: trial_job_id does not in running_history')
112710
function (parameters) {

        /**
         * Job identifier.
         * @type {string}
         */
        this.hash = parameters.hash;

        /**
         * Array of hashes to {@link Artifact}s containing each requested result.
         * @type {string[]}
         */
        this.resultHashes = parameters.resultHashes || [];

        /**
         * Hash to an {@link Artifact} containing the union of all requests results.
         * @type {string}
         */
        this.resultSuperSet = parameters.resultSuperSet || null;

        this.userId = parameters.userId || [];

        /**
         * Current status of the job.
         * @type {string}
         */
        this.status = parameters.status || null;

        /**
         * Timestamp of when the job was created.
         * @type {string}
         */
        this.createTime = parameters.createTime || null;

        /**
         * Timestamp of when the job execution started by a worker.
         * @type {string}
         */
        this.startTime = parameters.startTime || null;

        /**
         * Timestamp of when the job execution finished on the worker.
         * @type {string}
         */
        this.finishTime = parameters.finishTime || null;

        /**
         * Id/label of the worker processing the job.
         * @type {string}
         */
        this.worker = parameters.worker || null;

        /**
         * Array of labels for the job.
         * @type {string[]}
         */
        this.labels = parameters.labels || [];

        /**
         * The (id) outputNumber (0, 1, 2, ...) of the latest {@link OutputInfo} (for this job) available on the server.
         * When no output is available the number is <b>null</b>.
         * @type {number}
         */
        this.outputNumber = typeof parameters.outputNumber === 'number' ? parameters.outputNumber : null;
    }
59138
def define_params(self):
        '''
        
        '''
        input_dim = self.input_dim
        hidden_dim = self.hidden_dim
        prefix = self.name
        self.w_matrix = tf.Variable(tf.random_normal([input_dim, 3 * hidden_dim], stddev=0.1),
                                    name='/'.join([prefix, 'W']))
        self.U = tf.Variable(tf.random_normal([hidden_dim, 3 * hidden_dim], stddev=0.1),
                             name='/'.join([prefix, 'U']))
        self.bias = tf.Variable(tf.random_normal([1, 3 * hidden_dim], stddev=0.1),
                                name='/'.join([prefix, 'b']))
        return self
98518
def get_params(self):
        
        params = super().get_params()
        params.update({'beta': self.beta,
                       'knn': self.knn,
                       'decay': self.decay,
                       'bandwidth': self.bandwidth,
                       'distance': self.distance,
                       'thresh': self.thresh,
                       'n_jobs': self.n_jobs})
        return params
599892
def to_hash
      action = @parameters[:action]
      userid = @parameters[:userid]
      appname = @parameters[:appname] || @appname
      patientid = @parameters[:patientid]
      token = @parameters[:token] || @security_token
      parameter1 = process_date(@parameters[:parameter1]) || ''
      parameter2 = process_date(@parameters[:parameter2]) || ''
      parameter3 = process_date(@parameters[:parameter3]) || ''
      parameter4 = process_date(@parameters[:parameter4]) || ''
      parameter5 = process_date(@parameters[:parameter5]) || ''
      parameter6 = process_date(@parameters[:parameter6]) || ''
      data = Utilities::encode_data(@parameters[:data]) || ''

      {
        'Action' => action,
        'AppUserID' => userid,
        'Appname' => appname,
        'PatientID' => patientid,
        'Token' => token,
        'Parameter1' => parameter1,
        'Parameter2' => parameter2,
        'Parameter3' => parameter3,
        'Parameter4' => parameter4,
        'Parameter5' => parameter5,
        'Parameter6' => parameter6,
        'Data' => data
      }
    end