See the list of worker types which are known to be managed

        This method is only for debugging the ec2-manager

        This method gives output: ``v1/list-worker-types.json#``

        This method is ``experimental``
499513
async def listWorkerTypes(self, *args, **kwargs):
        

        return await self._makeApiCall(self.funcinfo["listWorkerTypes"], *args, **kwargs)
56931
def _check_types(self) -> None:
        
        all_instance_fields_and_types: List[Dict[str, str]] = [{k: v.__class__.__name__
                                                                for k, v in x.fields.items()}
                                                               for x in self.instances]
        # Check all the field names and Field types are the same for every instance.
        if not all([all_instance_fields_and_types[0] == x for x in all_instance_fields_and_types]):
            raise ConfigurationError("You cannot construct a Batch with non-homogeneous Instances.")
1242708
def list(self):
    
    import IPython

    # "self" is iterable (see __iter__() method).
    data = [{'name': version['name'].split()[-1],
             'deploymentUri': version['deploymentUri'], 'createTime': version['createTime']}
            for version in self.get_iterator()]
    IPython.display.display(
        datalab.utils.commands.render_dictionary(data, ['name', 'deploymentUri', 'createTime']))
789894
def list(self, allJobs=False):
        

        jobs = self.server.call('get', '/job')

        return [Job(job['id'], self.server) for job in jobs if allJobs or self._job_owned(job)]
82720
def entity_types(args):
    
    r = fapi.list_entity_types(args.project, args.workspace)
    fapi._check_response_code(r, 200)
    return r.json().keys()
546631
def get_ec2_instances(self):
        
        log = logging.getLogger(self.cls_logger + '.get_ec2_instances')
        log.info('Describing EC2 instances...')
        try:
            response = self.client.describe_instances()
        except ClientError:
            _, ex, trace = sys.exc_info()
            msg = '{n}: There was a problem describing EC2 instances\n{e}'.format(n=ex.__class__.__name__, e=str(ex))
            raise EC2UtilError, msg, trace
        return response
555846
function reserveWorker(workerType, callback) {
        var debug = false,
            execArgv = process.execArgv.filter(function (arg) {
                if (arg.indexOf('--debug-brk') === 0) {
                    debug = '--debug-brk';
                } else if (arg.indexOf('--debug') === 0) {
                    debug = '--debug';
                } else if (arg.indexOf('--inspect-brk') === 0) {
                    debug = '--inspect-brk';
                } else if (arg.indexOf('--inspect') === 0) {
                    debug = '--inspect';
                } else {
                    return true;
                }

                return false;
            }),
            childProcess;

        // http://stackoverflow.com/questions/16840623/how-to-debug-node-js-child-forked-process
        // For some reason --debug-brk is given here..
        if (debug) {
            execArgv.push(debug + '=' + debugPort.toString());
            logger.info('Child debug port: ' + debugPort.toString());
            debugPort += 2;
        }

        logger.debug('execArgv for main process', process.execArgv);
        logger.debug('execArgv for new child process', execArgv);

        childProcess = Child.fork(CONNECTED_WORKER_JS, [], {execArgv: execArgv});

        _workers[childProcess.pid] = {
            childProcess: childProcess,
            state: CONSTANTS.workerStates.initializing,
            type: workerType,
            cb: null
        };

        logger.debug('workerPid forked ' + childProcess.pid);
        childProcess.on('message', function (msg) {
            messageHandling(msg);

            // FIXME: Do we really need the "initialize" in addition to "initialized"?
            // FIXME: Why couldn't the worker start the initializing at spawn? (It can load the gmeConfig itself)
            if (msg.type === CONSTANTS.msgTypes.initialized && typeof callback === 'function') {
                callback();
                callback = null;
            }
        });

        childProcess.on('exit', function (code, signal) {
            logger.debug('worker has exited: ' + childProcess.pid);
            // When killing child-process the code is undefined and the signal SIGINT.
            if (code !== 0 && signal !== 'SIGINT') {
                logger.warn('worker ' + childProcess.pid + ' has exited abnormally with code ' + code +
                    ', signal', signal);
                if (typeof callback === 'function') {
                    callback(new Error('worker ' + childProcess.pid + ' exited abnormally with code ' + code));
                }
            } else {
                logger.debug('worker ' + childProcess.pid + ' was terminated.');
            }

            if (workerType === CONSTANTS.workerTypes.connected) {
                self.connectedWorkerId = null;
            }

            delete _workers[childProcess.pid];
            reserveWorker(workerType);
        });
    }
81059
def get_work_spec(self, work_spec_name):
        ''''''
        with self.registry.lock(identifier=self.worker_id) as session:
            return session.get(WORK_SPECS, work_spec_name)
1176389
def workers(cmd):
    
    if config.dbserver.multi_user and getpass.getuser() != 'openquake':
        sys.exit('oq workers only works in single user mode')

    master = workerpool.WorkerMaster(config.dbserver.host,
                                     **config.zworkers)
    print(getattr(master, cmd)())
85766
def _list(env, key, more, loader, _all=False, output=None):
    
    if env:
        env = env.strip()
    if key:
        key = key.strip()
    if loader:
        loader = loader.strip()

    if env:
        settings.setenv(env)

    cur_env = settings.current_env.lower()

    click.echo(
        click.style(
            "Working in %s environment " % cur_env,
            bold=True,
            bg="blue",
            fg="bright_black",
        )
    )

    if not loader:
        data = settings.as_dict(env=env, internal=_all)
    else:
        identifier = "{}_{}".format(loader, cur_env)
        data = settings._loaded_by_loaders.get(identifier, {})
        data = data or settings._loaded_by_loaders.get(loader, {})

    # remove to avoid displaying twice
    data.pop("SETTINGS_MODULE", None)

    def color(_k):
        if _k in dir(default_settings):
            return "blue"
        return "green"

    if not key:
        datalines = "\n".join(
            "%s: %s"
            % (click.style(k, bg=color(k), fg="white"), pprint.pformat(v))
            for k, v in data.items()
        )
        (click.echo_via_pager if more else click.echo)(datalines)
        if output:
            with open(output, "w") as output_file:
                json.dump({cur_env: data}, output_file)
    else:
        key = key.upper()
        value = data.get(key)
        if not value:
            click.echo(click.style("Key not found", bg="red", fg="white"))
            return
        click.echo(
            "%s: %s"
            % (
                click.style(key.upper(), bg=color(key), fg="white"),
                pprint.pformat(value),
            )
        )
        if output:
            with open(output, "w") as output_file:
                json.dump({cur_env: {key.upper(): value}}, output_file)

    if env:
        settings.setenv()
193936
function serializeWorker(worker) {
  return {
    id: worker.id,
    up: worker.up,
    lastCallDuration: worker.lastCallDuration,
    meanCallDuration: worker.meanCallDuration,
    host: worker.host,
    port: worker.port,
    type: worker.type
  }
}
542598
def field_types(self):
        
        if self._field_types is None:
            self._field_types = FieldTypeList(self._version, assistant_sid=self._solution['sid'], )
        return self._field_types
348007
def worker_channels(self):
        
        if self._worker_channels is None:
            self._worker_channels = WorkerChannelList(
                self._version,
                workspace_sid=self._solution['workspace_sid'],
                worker_sid=self._solution['sid'],
            )
        return self._worker_channels
1062734
def getSampleTypes(self, active_only=True):
        
        catalog = api.get_tool("bika_setup_catalog")
        query = {
            "portal_type": "SampleType",
            # N.B. The `sortable_title` index sorts case sensitive. Since there
            #      is no sort key for sample types, it makes more sense to sort
            #      them alphabetically in the selection
            "sort_on": "title",
            "sort_order": "ascending"
        }
        results = catalog(query)
        if active_only:
            results = filter(api.is_active, results)
        sampletypes = map(
            lambda brain: (brain.UID, brain.Title), results)
        return DisplayList(sampletypes)
79527
async def workerTypeErrors(self, *args, **kwargs):
        

        return await self._makeApiCall(self.funcinfo["workerTypeErrors"], *args, **kwargs)
1338993
def _get_filesystem_types(args, sample_file):
    
    out = set([])
    ext = "" if args.no_container else "_container"
    with open(sample_file) as in_handle:
        for f in _get_file_paths(json.load(in_handle)):
            if f.startswith("gs:"):
                out.add("gcp%s" % ext)
            elif f.startswith("s3:"):
                out.add("s3%s" % ext)
            elif f.startswith(("https:", "http:")):
                out.add("http%s" % ext)
            else:
                out.add("local%s" % ext)
    return out
131040
def list_streams(self, types=[], inactive=False):
        '''  '''
        req_hook = 'pod/v1/streams/list'
        json_query = {
                       "streamTypes": types,
                       "includeInactiveStreams": inactive
                     }
        req_args = json.dumps(json_query)
        status_code, response = self.__rest__.POST_query(req_hook, req_args)
        self.logger.debug('%s: %s' % (status_code, response))
        return status_code, response