Executor for `globus endpoint update`
519467
def endpoint_update(**kwargs):
    
    # validate params. Requires a get call to check the endpoint type
    client = get_client()
    endpoint_id = kwargs.pop("endpoint_id")
    get_res = client.get_endpoint(endpoint_id)

    if get_res["host_endpoint_id"]:
        endpoint_type = "shared"
    elif get_res["is_globus_connect"]:
        endpoint_type = "personal"
    elif get_res["s3_url"]:
        endpoint_type = "s3"
    else:
        endpoint_type = "server"
    validate_endpoint_create_and_update_params(
        endpoint_type, get_res["subscription_id"], kwargs
    )

    # make the update
    ep_doc = assemble_generic_doc("endpoint", **kwargs)
    res = client.update_endpoint(endpoint_id, ep_doc)
    formatted_print(res, text_format=FORMAT_TEXT_RAW, response_key="message")
300970
def update_finished(self):
        
        if self.is_updateable:
            javabridge.call(self.jobject, "updateFinished", "()V")
        else:
            logger.critical(classes.get_classname(self.jobject) + " is not updateable!")
956197
public void autoUpdate(ScheduledExecutorService executor,TimeUnit unit,long time)
	{
		executor.scheduleAtFixedRate(updateTask,time, time, unit);
	}
685477
function executeBatch(bulkOperation, batch, options, callback) {
  function resultHandler(err, result) {
    // Error is a driver related error not a bulk op error, terminate
    if (((err && err.driver) || (err && err.message)) && !(err instanceof MongoWriteConcernError)) {
      return handleCallback(callback, err);
    }

    // If we have and error
    if (err) err.ok = 0;
    if (err instanceof MongoWriteConcernError) {
      return handleMongoWriteConcernError(batch, bulkOperation.s.bulkResult, false, err, callback);
    }
    handleCallback(
      callback,
      null,
      mergeBatchResults(false, batch, bulkOperation.s.bulkResult, err, result)
    );
  }

  bulkOperation.finalOptionsHandler({ options, batch, resultHandler }, callback);
}
642607
def execute_legacy(self, sock_info, generator, write_concern):
        
        coll = self.collection
        full_result = {
            "writeErrors": [],
            "writeConcernErrors": [],
            "nInserted": 0,
            "nUpserted": 0,
            "nMatched": 0,
            "nRemoved": 0,
            "upserted": [],
        }
        op_id = _randint()
        stop = False
        for run in generator:
            for idx, operation in enumerate(run.ops):
                try:
                    # To do per-operation reporting we have to do ops one
                    # at a time. That means the performance of bulk insert
                    # will be slower here than calling Collection.insert()
                    if run.op_type == _INSERT:
                        coll._insert(sock_info,
                                     operation,
                                     self.ordered,
                                     write_concern=write_concern,
                                     op_id=op_id)
                        result = {}
                    elif run.op_type == _UPDATE:
                        doc = operation['u']
                        check_keys = True
                        if doc and next(iter(doc)).startswith('$'):
                            check_keys = False
                        result = coll._update(sock_info,
                                              operation['q'],
                                              doc,
                                              operation['upsert'],
                                              check_keys,
                                              operation['multi'],
                                              write_concern=write_concern,
                                              op_id=op_id,
                                              ordered=self.ordered)
                    else:
                        result = coll._delete(sock_info,
                                              operation['q'],
                                              not operation['limit'],
                                              write_concern,
                                              op_id,
                                              self.ordered)
                    _merge_legacy(run, full_result, result, idx)
                except DocumentTooLarge as exc:
                    # MongoDB 2.6 uses error code 2 for "too large".
                    error = _make_error(
                        run.index(idx), _BAD_VALUE, str(exc), operation)
                    full_result['writeErrors'].append(error)
                    if self.ordered:
                        stop = True
                        break
                except OperationFailure as exc:
                    if not exc.details:
                        # Some error not related to the write operation
                        # (e.g. kerberos failure). Re-raise immediately.
                        raise
                    _merge_legacy(run, full_result, exc.details, idx)
                    # We're supposed to continue if errors are
                    # at the write concern level (e.g. wtimeout)
                    if self.ordered and full_result["writeErrors"]:
                        stop = True
                        break
            if stop:
                break

        if full_result["writeErrors"] or full_result['writeConcernErrors']:
            if full_result['writeErrors']:
                full_result['writeErrors'].sort(
                    key=lambda error: error['index'])
            raise BulkWriteError(full_result)
        return full_result
408365
def update_endpoint(self, endpoint):
        
        self._validate_uuid(endpoint.endpoint_id)
        self._validate_subscriber_id(endpoint.subscriber_id)

        url = "/notification/v1/endpoint/{}".format(endpoint.endpoint_id)
        response = NWS_DAO().putURL(
            url, self._write_headers(), self._json_body(endpoint.json_data()))

        if response.status != 204:
            raise DataFailureException(url, response.status, response.data)
        return response.status
458428
def run(self):
        '''
        
        '''
        new_mins = list(salt.utils.minions.CkMinions(self.opts).connected_ids())
        cc = cache_cli(self.opts)
        cc.get_cached()
        cc.put_cache([new_mins])
        log.debug('ConCache CacheWorker update finished')
438712
def server_delete(endpoint_id, server):
    
    client = get_client()

    mode = _detect_mode(server)

    # list (even if not necessary) in order to make errors more consistent when
    # mode='id'
    endpoint, server_list = get_endpoint_w_server_list(endpoint_id)

    if server_list == "S3":
        raise click.UsageError("You cannot delete servers from S3 endpoints.")

    # we don't *have to* raise an error in the GCP case, since the API would
    # deny it too, but doing so makes our errors a little bit more consistent
    # with deletes against S3 endpoints and shares
    if endpoint["is_globus_connect"]:
        raise click.UsageError(
            "You cannot delete servers from Globus Connect Personal endpoints"
        )

    if mode != "id":
        matches = _spec_to_matches(server_list, server, mode)
        if not matches:
            raise click.UsageError('No server was found matching "{}"'.format(server))
        elif len(matches) > 1:
            raise click.UsageError(
                dedent(
                    """\
                Multiple servers matched "{}":
                    {}
            """
                ).format(server, [x["id"] for x in matches])
            )
        else:
            server = matches[0]["id"]

    response = client.delete_endpoint_server(endpoint_id, server)

    formatted_print(response, text_format=FORMAT_TEXT_RAW, response_key="message")
711349
def update_fileserver(self, interval, backends):
        '''
        
        '''
        def _do_update():
            log.debug(
                'Performing fileserver updates for items with an update '
                'interval of %d', interval
            )
            for backend, update_args in six.iteritems(backends):
                backend_name, update_func = backend
                try:
                    if update_args:
                        log.debug(
                            'Updating %s fileserver cache for the following '
                            'targets: %s', backend_name, update_args
                        )
                        args = (update_args,)
                    else:
                        log.debug('Updating %s fileserver cache', backend_name)
                        args = ()

                    update_func(*args)
                except Exception as exc:
                    log.exception(
                        'Uncaught exception while updating %s fileserver '
                        'cache', backend_name
                    )

            log.debug(
                'Completed fileserver updates for items with an update '
                'interval of %d, waiting %d seconds', interval, interval
            )

        condition = threading.Condition()
        _do_update()
        while True:
            with condition:
                condition.wait(interval)
            _do_update()
1119424
def execute_greenlet_async(func, *args, **kwargs):
  
  global _GREENLET_EXECUTOR
  if _GREENLET_EXECUTOR is None:
    _GREENLET_EXECUTOR = GreenletExecutor(
      num_greenlets=settings.node.greenlet_pool_size)
  return _GREENLET_EXECUTOR.submit(func, *args, **kwargs)
363578
def endpoint_show(endpoint_id):
    
    client = get_client()

    res = client.get_endpoint(endpoint_id)

    formatted_print(
        res,
        text_format=FORMAT_TEXT_RECORD,
        fields=GCP_FIELDS if res["is_globus_connect"] else STANDARD_FIELDS,
    )
1185801
def update(client, revision, no_output, siblings, paths):
    """"""
    graph = Graph(client)
    outputs = graph.build(revision=revision, can_be_cwl=no_output, paths=paths)
    outputs = {node for node in outputs if graph.need_update(node)}

    if not outputs:
        click.secho(
            'All files were generated from the latest inputs.', fg='green'
        )
        sys.exit(0)

    # Check or extend siblings of outputs.
    outputs = siblings(graph, outputs)
    output_paths = {node.path for node in outputs if _safe_path(node.path)}

    # Get all clean nodes.
    input_paths = {node.path for node in graph.nodes} - output_paths

    # Store the generated workflow used for updating paths.
    import yaml

    output_file = client.workflow_path / '{0}.cwl'.format(uuid.uuid4().hex)
    workflow = graph.ascwl(
        input_paths=input_paths,
        output_paths=output_paths,
        outputs=outputs,
    )

    # Make sure all inputs are pulled from a storage.
    client.pull_paths_from_storage(
        *(path for _, path in workflow.iter_input_files(client.workflow_path))
    )

    with output_file.open('w') as f:
        f.write(
            yaml.dump(
                ascwl(
                    workflow,
                    filter=lambda _, x: x is not None,
                    basedir=client.workflow_path,
                ),
                default_flow_style=False
            )
        )

    from ._cwl import execute
    execute(client, output_file, output_paths=output_paths)
292039
def update(gandi, address, dest_add, dest_del):
    """"""
    source, domain = address

    if not dest_add and not dest_del:
        gandi.echo('Nothing to update: you must provide destinations to '
                   'update, use --dest-add/-a or -dest-del/-d parameters.')
        return

    result = gandi.forward.update(domain, source, dest_add, dest_del)

    return result
134226
def run(endpoint, name=None):
    """"""
    try:
        if os.isatty(0):
            # output mode
            for data in stream_skypipe_output(endpoint, name):
                sys.stdout.write(data)
                sys.stdout.flush()

        else:
            # input mode
            with skypipe_input_stream(endpoint, name) as stream:
                for line in stream_stdin_lines():
                    stream.send(line)

    except KeyboardInterrupt:
        pass
873839
def update(self, ng_template_id, name=NotUpdated, plugin_name=NotUpdated,
               plugin_version=NotUpdated, flavor_id=NotUpdated,
               description=NotUpdated, volumes_per_node=NotUpdated,
               volumes_size=NotUpdated, node_processes=NotUpdated,
               node_configs=NotUpdated, floating_ip_pool=NotUpdated,
               security_groups=NotUpdated, auto_security_group=NotUpdated,
               availability_zone=NotUpdated,
               volumes_availability_zone=NotUpdated, volume_type=NotUpdated,
               image_id=NotUpdated, is_proxy_gateway=NotUpdated,
               volume_local_to_instance=NotUpdated, use_autoconfig=NotUpdated,
               shares=NotUpdated, is_public=NotUpdated,
               is_protected=NotUpdated, volume_mount_prefix=NotUpdated,
               boot_from_volume=NotUpdated,
               boot_volume_type=NotUpdated,
               boot_volume_availability_zone=NotUpdated,
               boot_volume_local_to_instance=NotUpdated):
        """"""

        data = {}
        self._copy_if_updated(
            data, name=name, plugin_name=plugin_name,
            plugin_version=plugin_version, flavor_id=flavor_id,
            description=description, volumes_per_node=volumes_per_node,
            volumes_size=volumes_size, node_processes=node_processes,
            node_configs=node_configs, floating_ip_pool=floating_ip_pool,
            security_groups=security_groups,
            auto_security_group=auto_security_group,
            availability_zone=availability_zone,
            volumes_availability_zone=volumes_availability_zone,
            volume_type=volume_type, image_id=image_id,
            is_proxy_gateway=is_proxy_gateway,
            volume_local_to_instance=volume_local_to_instance,
            use_autoconfig=use_autoconfig, shares=shares,
            is_public=is_public, is_protected=is_protected,
            volume_mount_prefix=volume_mount_prefix,
            boot_from_volume=boot_from_volume,
            boot_volume_type=boot_volume_type,
            boot_volume_availability_zone=boot_volume_availability_zone,
            boot_volume_local_to_instance=boot_volume_local_to_instance
        )

        return self._patch('/node-group-templates/%s' % ng_template_id, data,
                           'node_group_template')
526153
def do_updatereplication(self, line):
        """"""
        pids = self._split_args(line, 1, -1)
        self._command_processor.update_replication_policy(pids)
        self._print_info_if_verbose(
            "Added replication policy update operation for identifiers {} to write queue".format(
                ", ".join(pids)
            )
        )
736446
def update(self, obj_id, is_public=NotUpdated, is_protected=NotUpdated):
        """"""

        data = {}
        self._copy_if_updated(data, is_public=is_public,
                              is_protected=is_protected)
        return self._patch('/job-executions/%s' % obj_id, data)