Create an instance of the Time Series Service with the typical
        starting settings.
194157
def create(self):
        
        self.service.create()

        os.environ[predix.config.get_env_key(self.use_class, 'host')] = self.get_eventhub_host()
        os.environ[predix.config.get_env_key(self.use_class, 'port')] = self.get_eventhub_grpc_port()
        os.environ[predix.config.get_env_key(self.use_class, 'wss_publish_uri')] = self.get_publish_wss_uri()
        os.environ[predix.config.get_env_key(self.use_class, 'zone_id')] = self.get_zone_id()
986724
def started(self):
        
        statistics = self._properties.get("statistics")
        if statistics is not None:
            millis = statistics.get("startTime")
            if millis is not None:
                return _helpers._datetime_from_microseconds(millis * 1000.0)
1327402
def new_start(start = Date::ITALY)
      if_timezone_offset(super) {|o,dt| dt.set_timezone_offset(o) }
    end
961784
def create_instance(credentials, project, zone, name,
                    startup_script=None, startup_script_url=None,
                    metadata=None,
                    machine_type='f1-micro', tags=None,
                    disk_size_gb=10, wait_until_done=False):
    """"""

    if startup_script is not None and startup_script_url is not None:
        raise ValueError('Cannot specify a startup script string and URL '
                         'at the same time!')

    access_token = credentials.get_access_token()

    if metadata is None:
        metadata = {}
    meta_items = [{'key': k, 'value': v} for k, v in metadata.items()]

    if tags is None:
        tags = []

    if startup_script is not None:
        meta_items.insert(
            0, {'key': 'startup-script', 'value': startup_script}
        )
    elif startup_script_url is not None:
        meta_items.insert(
            0, {'key': 'startup-script-url', 'value': startup_script_url})

    payload = {
        "name": name,
        "zone": "projects/%s/zones/%s" % (project, zone),
        "machineType": "projects/%s/zones/%s/machineTypes/%s"
                       % (project, zone, machine_type),
        "metadata": {
            "items": meta_items
        },
        "tags": {
            "items": tags
        },
        "disks": [
            {
                "type": "PERSISTENT",
                "boot": True,
                "mode": "READ_WRITE",
                "autoDelete": True,
                "deviceName": name,
                "initializeParams": {
                    "sourceImage": "projects/ubuntu-os-cloud/global/images/ubuntu-1604-xenial-v20170815a",
                    "diskType": "projects/%s/zones/%s/diskTypes/pd-standard" % (project, zone),
                    "diskSizeGb": str(disk_size_gb)
                }
            }
        ],
        "canIpForward": False,
        "networkInterfaces": [
            {
                "network": "projects/%s/global/networks/default" % project,
                "subnetwork": "projects/%s/regions/%s/subnetworks/default" % (project, zone[:-2]),
                "accessConfigs": [
                    {
                        "name": "External NAT", "type": "ONE_TO_ONE_NAT"
                    }
                ]
            }
        ],
        "description": "",
        "scheduling": {
            "preemptible": False,
            "onHostMaintenance": "MIGRATE",
            "automaticRestart": True
        },
        "serviceAccounts": [
            {
                "email": "default",
                "scopes": [
                    'https://www.googleapis.com/auth/compute',
                    "https://www.googleapis.com/auth/devstorage.read_write",
                    "https://www.googleapis.com/auth/logging.write",
                    "https://www.googleapis.com/auth/monitoring.write",
                    "https://www.googleapis.com/auth/servicecontrol",
                    "https://www.googleapis.com/auth/service.management.readonly",
                    "https://www.googleapis.com/auth/trace.append"
                ]
            }
        ]
    }
    #header = 'Authorization: Bearer 1/fFBGRNJru1FQd44AzqT3Zg'
    headers = {
        'Authorization': 'Bearer %s' % access_token.access_token
    }

    #print('Test:', json.dumps(payload, indent=4, sort_keys=True))
    
    _LOGGER.debug('Access token: %s' % access_token.access_token)

    _LOGGER.debug('Payload: %s', json.dumps(payload, sort_keys=True, indent=4))


    r = requests.post('https://www.googleapis.com/compute/v1/'
                      'projects/%s/zones/%s/instances' % (project, zone),
                      headers=headers, json=payload)

    r.raise_for_status()

    op_name = r.json()['name']

    _LOGGER.info('Submitted request to create intsance '
                '(HTTP code: %d).',
                r.status_code)

    if wait_until_done:
        _LOGGER.info('Waiting until operation is done...')
        wait_for_zone_op(access_token, project, zone, op_name)

    return op_name
765021
def _start(self):
        
        try:
            # Try to register to factory events
            with use_ipopo(self.__context) as ipopo:
                ipopo.add_listener(self)
        except BundleException:
            # Service not yet present
            pass

        # Register the iPOPO service listener
        self.__context.add_service_listener(self, specification=SERVICE_IPOPO)
434903
def _create_historical_estimates(resource, configuration):
    
    today = timezone.now()
    month_start = core_utils.month_start(today)
    while month_start > resource.created:
        month_start -= relativedelta(months=1)
        models.PriceEstimate.create_historical(resource, configuration, max(month_start, resource.created))
884287
public void start() {
		
		lock.lock();
		
		try {
			executorService = Executors.newSingleThreadScheduledExecutor();
			
			try {
				startUp();
			} catch (Throwable t) {
				LOGGER.info("Exception in service start up", t);
			}
			
			currentFuture = executorService.schedule(new RunOneIterationAndReschedule(), 0, TimeUnit.MILLISECONDS);
		} finally {
			lock.unlock();
		}
	}
905604
def start():
    
    pool = gevent.threadpool.ThreadPool(len(ENTRYPOINTS))
    for entrypoint, callback, args, kwargs in ENTRYPOINTS:
        cname = callback.__name__
        #1. Retrieve the class which owns the callback
        for name, klass in inspect.getmembers(sys.modules[callback.__module__], inspect.isclass):
            if hasattr(klass, cname):
                service_name = name.lower()
                break
        #2.Start the entrypoint
        callback = getattr(klass(), cname)
        kwargs.update({'service':service_name, 'callback':callback, 'callback_name': cname})
        LOGGER.info('Start service %s[%s].', service_name.capitalize(), cname)
        obj = entrypoint(*args, **kwargs)
        pool.spawn(obj.start, *args, **kwargs)
    pool.join()
    return True
472840
def CreateTaskStart(self):
    
    task_start = TaskStart()
    task_start.identifier = self.identifier
    task_start.session_identifier = self.session_identifier
    task_start.timestamp = self.start_time
    return task_start
1132877
def create(self):
        
        # add various pointers to those editing vent_cfg
        if self.vent_cfg:
            self.add(npyscreen.Textfield,
                     value='# when configuring external'
                           ' services make sure to do so',
                     editable=False)
            self.add(npyscreen.Textfield,
                     value='# in the form of Service = {"setting": "value"}',
                     editable=False)
            self.add(npyscreen.Textfield,
                     value='# make sure to capitalize your service correctly'
                           ' (i.e. Elasticsearch vs. elasticsearch)',
                     editable=False)
            self.add(npyscreen.Textfield,
                     value='# and make sure to enclose all dict keys and'
                           ' values in double quotes ("")',
                     editable=False)
            self.add(npyscreen.Textfield,
                     value='',
                     editable=False)
        elif self.instance_cfg:
            self.add(npyscreen.Textfield,
                     value='# these settings will be used'
                           ' to configure the new instances',
                     editable=False)
        self.edit_space = self.add(npyscreen.MultiLineEdit,
                                   value=self.config_val)
600802
def new(cls, settings, *args, **kwargs):
        
        logger.debug('Initializing new "%s" Instance object' % settings['CLOUD'])
        cloud = settings['CLOUD']
        if cloud == 'bare':
            self = BareInstance(settings=settings, *args, **kwargs)
        elif cloud == 'aws':
            self = AWSInstance(settings=settings, *args, **kwargs)
        elif cloud == 'gcp':
            self = GCPInstance(settings=settings, *args, **kwargs)
        else:
            raise DSBException('Cloud "%s" not supported' % cloud)
        return self
881124
def create(self):
        
        self.service.create()

        # Set environment variables for immediate use
        predix.config.set_env_value(self.use_class, 'uri', self._get_uri())
        predix.config.set_env_value(self.use_class, 'zone_id',
                self._get_zone_id())
866007
public Simulation create() {
      if (tickCount == null)
         throw new IllegalStateException("tick count not set");
      return new SimulationImpl(tickCount, phases, members, series, services);
   }
858138
def init(self):
        '''
        
        '''
        self.previous_value = None
        self.last_update_time = None
        self.start_time = None
        self.updates = 0
        self.end_time = None
        self.extra = dict()
        self._last_update_timer = timeit.default_timer()
87885
def _create_series(ndschan, value, start, end, series_class=TimeSeries):
    
    channel = Channel.from_nds2(ndschan)
    nsamp = int((end - start) * channel.sample_rate.value)
    return series_class(numpy_ones(nsamp) * value, t0=start,
                        sample_rate=channel.sample_rate, unit=channel.unit,
                        channel=channel)
20797
def my_init(self):
        
        self._start_time = time.time()
        self._stats = {}
        self._stats_lock = threading.Lock()
732281
def _create_service(self, parameters={}, **kwargs):
        
        logging.debug("_create_service()")
        logging.debug(str.join(',', [self.service_name, self.plan_name,
            self.name, str(parameters)]))

        return self.service.create_service(self.service_name, self.plan_name,
                self.name, parameters, **kwargs)