Creates a new replica using WAL-E

        Returns
        -------
        ExitCode
            0 = Success
            1 = Error, try again
            2 = Error, don't try again
963274
def run(self):
        
        if self.init_error:
            logger.error('init error: %r did not exist at initialization time',
                         self.wal_e.env_dir)
            return ExitCode.FAIL

        try:
            should_use_s3 = self.should_use_s3_to_create_replica()
            if should_use_s3 is None:  # Need to retry
                return ExitCode.RETRY_LATER
            elif should_use_s3:
                return self.create_replica_with_s3()
            elif not should_use_s3:
                return ExitCode.FAIL
        except Exception:
            logger.exception("Unhandled exception when running WAL-E restore")
        return ExitCode.FAIL
723215
def create(self, repo_name, scm='git', private=True, **kwargs):
        
        url = self.bitbucket.url('CREATE_REPO')
        return self.bitbucket.dispatch('POST', url, auth=self.bitbucket.auth, name=repo_name, scm=scm, is_private=private, **kwargs)
740805
def create_script(create=None):  # noqa: E501
    
    if connexion.request.is_json:
        create = Create.from_dict(connexion.request.get_json())  # noqa: E501

    if(not hasAccess()):
        return redirectUnauthorized()

    driver = LoadedDrivers.getDefaultDriver()
    driver.saveScript(create.script.name, create.script.content)
    return Response(status=200, body={'file-name': create.script.name})
798466
def create_execve(original_name):
    

    def new_execve(path, args, env):
        import os
        send_process_created_message()
        return getattr(os, original_name)(path, patch_args(args), env)

    return new_execve
322099
def create_ondemand_instances(ec2, image_id, spec, num_instances=1):
    
    instance_type = spec['instance_type']
    log.info('Creating %s instance(s) ... ', instance_type)
    for attempt in retry_ec2(retry_for=a_long_time,
                             retry_while=inconsistencies_detected):
        with attempt:
            return ec2.run_instances(image_id,
                                     min_count=num_instances,
                                     max_count=num_instances,
                                     **spec).instances
1055679
def create_spawnve(original_name):
    

    def new_spawnve(mode, path, args, env):
        import os
        send_process_created_message()
        return getattr(os, original_name)(mode, path, patch_args(args), env)

    return new_spawnve
824446
def _create(self):
        
        # Create new file
        with _handle_azure_exception():
            self._create_from_size(
                content_length=self._content_length, **self._client_kwargs)
934805
function createError (errorMessage, statusCode, statusMessage) {

	if (statusCode) {
		errorMessage = errorMessage + '\nHTTP[S] status: ' + statusCode;

		if (statusMessage) {
			errorMessage = errorMessage + ' ' + statusMessage;
		}
	}

	statusCode = statusCode || 0;
	statusMessage = statusMessage || 'Unspecified';

	let error = new Error(errorMessage);

	error.statusCode = statusCode;
	error.statusMessage = statusMessage;

	return error;
}
977811
def create(self, *args, **kwargs):
        
        try:
            return super(CloudBlockStorageManager, self).create(*args,
                    **kwargs)
        except exc.BadRequest as e:
            msg = e.message
            if "Clones currently must be >= original volume size" in msg:
                raise exc.VolumeCloneTooSmall(msg)
            else:
                raise
985316
def _create_connection(self):
        
        attempts = 0
        while True:
            attempts += 1
            if self._stopped.is_set():
                break
            try:
                self._connection = Connection(self.hostname,
                                              self.username,
                                              self.password)
                break
            except amqpstorm.AMQPError as why:
                LOGGER.warning(why)
                if self.max_retries and attempts > self.max_retries:
                    raise Exception('max number of retries reached')
                time.sleep(min(attempts * 2, 30))
            except KeyboardInterrupt:
                break
316892
def create(self, instance, errors):
        
        if errors:
            return self.errors(errors)
        return self.created(instance)
854892
def create(cls, **kwargs):
        
        linkname = kwargs.setdefault('linkname', cls.clientclass.linkname_default)
        # Don't use setdefault b/c we don't want to build a JobArchive
        # Unless it is needed
        job_archive = kwargs.get('job_archive', None)
        if job_archive is None:
            job_archive = JobArchive.build_temp_job_archive()
            kwargs.setdefault('job_archive', job_archive)
        kwargs_client = dict(linkname=linkname,
                             link_prefix=kwargs.get('link_prefix', ''),
                             file_stage=kwargs.get('file_stage', None),
                             job_archive=job_archive)
        link = cls.clientclass.create(**kwargs_client)
        sg = cls(link, **kwargs)
        return sg
1361559
def create_replica(self, clone_member):
        

        self.set_state('creating replica')
        self._sysid = None

        is_remote_master = isinstance(clone_member, RemoteMember)
        create_replica_methods = is_remote_master and clone_member.create_replica_methods

        # get list of replica methods either from clone member or from
        # the config. If there is no configuration key, or no value is
        # specified, use basebackup
        replica_methods = (
            create_replica_methods
            or self._create_replica_methods
            or ['basebackup']
        )

        if clone_member and clone_member.conn_url:
            r = clone_member.conn_kwargs(self._replication)
            connstring = 'postgres://{user}@{host}:{port}/{database}'.format(**r)
            # add the credentials to connect to the replica origin to pgpass.
            env = self.write_pgpass(r)
        else:
            connstring = ''
            env = os.environ.copy()
            # if we don't have any source, leave only replica methods that work without it
            replica_methods = \
                [r for r in replica_methods if self.replica_method_can_work_without_replication_connection(r)]

        # go through them in priority order
        ret = 1
        for replica_method in replica_methods:
            with self._cancellable_lock:
                if self._is_cancelled:
                    break
            # if the method is basebackup, then use the built-in
            if replica_method == "basebackup":
                ret = self.basebackup(connstring, env, self.config.get(replica_method, {}))
                if ret == 0:
                    logger.info("replica has been created using basebackup")
                    # if basebackup succeeds, exit with success
                    break
            else:
                if not self.data_directory_empty():
                    if self.config.get(replica_method, {}).get('keep_data', False):
                        logger.info('Leaving data directory uncleaned')
                    else:
                        self.remove_data_directory()

                cmd = replica_method
                method_config = {}
                # user-defined method; check for configuration
                # not required, actually
                if self.config.get(replica_method, {}):
                    method_config = self.config[replica_method].copy()
                    # look to see if the user has supplied a full command path
                    # if not, use the method name as the command
                    cmd = method_config.pop('command', cmd)

                # add the default parameters
                if not method_config.get('no_params', False):
                    method_config.update({"scope": self.scope,
                                          "role": "replica",
                                          "datadir": self._data_dir,
                                          "connstring": connstring})
                else:
                    for param in ('no_params', 'no_master', 'keep_data'):
                        method_config.pop(param, None)
                params = ["--{0}={1}".format(arg, val) for arg, val in method_config.items()]
                try:
                    # call script with the full set of parameters
                    ret = self.cancellable_subprocess_call(shlex.split(cmd) + params, env=env)
                    # if we succeeded, stop
                    if ret == 0:
                        logger.info('replica has been created using %s', replica_method)
                        break
                    else:
                        logger.error('Error creating replica using method %s: %s exited with code=%s',
                                     replica_method, cmd, ret)
                except Exception:
                    logger.exception('Error creating replica using method %s', replica_method)
                    ret = 1

        self.set_state('stopped')
        return ret
133210
def _handle_create(self, response, ignore_tombstone, auto_refresh):

		'''
		
		'''

		# 201, success, refresh
		if response.status_code == 201:
			# if not specifying uri, capture from response and append to object
			self.uri = self.repo.parse_uri(response.text)
			# creation successful
			if auto_refresh:
				self.refresh()
			elif auto_refresh == None:
				if self.repo.default_auto_refresh:
					self.refresh()
			# fire resource._post_create hook if exists
			if hasattr(self,'_post_create'):
				self._post_create(auto_refresh=auto_refresh)

		# 404, assumed POST, target location does not exist
		elif response.status_code == 404:
			raise Exception('HTTP 404, for this POST request target location does not exist')

		# 409, conflict, resource likely exists
		elif response.status_code == 409:
			raise Exception('HTTP 409, resource already exists')

		# 410, tombstone present
		elif response.status_code == 410:
			if ignore_tombstone:
				response = self.repo.api.http_request('DELETE', '%s/fcr:tombstone' % self.uri)
				if response.status_code == 204:
					logger.debug('tombstone removed, retrying create')
					self.create()
				else:
					raise Exception('HTTP %s, Could not remove tombstone for %s' % (response.status_code, self.uri))
			else:
				raise Exception('tombstone for %s detected, aborting' % self.uri)

		# 415, unsupported media type
		elif response.status_code == 415:
			raise Exception('HTTP 415, unsupported media type')

		# unknown status code
		else:
			raise Exception('HTTP %s, unknown error creating resource' % response.status_code)

		# if all goes well, return self
		return self
1328902
def create(model_config, model, vec_env, storage, takes, parallel_envs, action_noise=None, sample_args=None):
    
    return EvaluateEnvCommand(
        model_config=model_config,
        model_factory=model,
        env_factory=vec_env,
        parallel_envs=parallel_envs,
        action_noise=action_noise,
        storage=storage,
        takes=takes,
        sample_args=sample_args
    )
951585
def create_gce_image(zone,
                     project,
                     instance_name,
                     name,
                     description):
    

    disk_name = instance_name
    try:
        down_gce(instance_name=instance_name, project=project, zone=zone)
    except HttpError as e:
        if e.resp.status == 404:
            log_yellow("the instance {} is already down".format(instance_name))
        else:
            raise e

    body = {
        "rawDisk": {},
        "name": name,
        "sourceDisk": "projects/{}/zones/{}/disks/{}".format(
            project, zone, disk_name
        ),
        "description": description
    }
    compute = _get_gce_compute()
    gce_wait_until_done(
        compute.images().insert(project=project, body=body).execute()
    )
    return name
42961
def create(self, method, uri, params=None, data=None, headers=None, auth=None, timeout=None,
               allow_redirects=False):
        
        response = self.request(
            method,
            uri,
            params=params,
            data=data,
            headers=headers,
            auth=auth,
            timeout=timeout,
            allow_redirects=allow_redirects,
        )

        if response.status_code < 200 or response.status_code >= 300:
            raise self.exception(method, uri, response, 'Unable to create record')

        return json.loads(response.text)