text stringlengths 81 112k |
|---|
Like :meth:`first` but aborts with 404 if not found instead of returning ``None``.
def first_or_404(self, description=None):
"""Like :meth:`first` but aborts with 404 if not found instead of returning ``None``."""
rv = self.first()
if rv is None:
abort(404, description=description)... |
Returns ``per_page`` items from page ``page``.
If ``page`` or ``per_page`` are ``None``, they will be retrieved from
the request query. If ``max_per_page`` is specified, ``per_page`` will
be limited to that value. If there is no request or they aren't in the
query, they default to 1 and... |
Create a :class:`~sqlalchemy.orm.scoping.scoped_session`
on the factory from :meth:`create_session`.
An extra key ``'scopefunc'`` can be set on the ``options`` dict to
specify a custom scope function. If it's not provided, Flask's app
context stack identity is used. This will ensure th... |
Create the session factory used by :meth:`create_scoped_session`.
The factory **must** return an object that SQLAlchemy recognizes as a session,
or registering session events may raise an exception.
Valid factories include a :class:`~sqlalchemy.orm.session.Session`
class or a :class:`~... |
Creates the declarative base that all models will inherit from.
:param model: base model class (or a tuple of base classes) to pass
to :func:`~sqlalchemy.ext.declarative.declarative_base`. Or a class
returned from ``declarative_base``, in which case a new base class
is not c... |
This callback can be used to initialize an application for the
use with this database setup. Never use a database in the context
of an application not initialized that way or connections will
leak.
def init_app(self, app):
"""This callback can be used to initialize an application for t... |
This method is called before engine creation and used to inject
driver specific hacks into the options. The `options` parameter is
a dictionary of keyword arguments that will then be used to call
the :func:`sqlalchemy.create_engine` function.
The default implementation provides some sa... |
Creates the connector for a given state and bind.
def make_connector(self, app=None, bind=None):
"""Creates the connector for a given state and bind."""
return _EngineConnector(self, self.get_app(app), bind) |
Returns a specific engine.
def get_engine(self, app=None, bind=None):
"""Returns a specific engine."""
app = self.get_app(app)
state = get_state(app)
with self._engine_lock:
connector = state.connectors.get(bind)
if connector is None:
connector... |
Helper method that implements the logic to look up an
application.
def get_app(self, reference_app=None):
"""Helper method that implements the logic to look up an
application."""
if reference_app is not None:
return reference_app
if current_app:
return ... |
Returns a list of all tables relevant for a bind.
def get_tables_for_bind(self, bind=None):
"""Returns a list of all tables relevant for a bind."""
result = []
for table in itervalues(self.Model.metadata.tables):
if table.info.get('bind_key') == bind:
result.append(t... |
Returns a dictionary with a table->engine mapping.
This is suitable for use of sessionmaker(binds=db.get_binds(app)).
def get_binds(self, app=None):
"""Returns a dictionary with a table->engine mapping.
This is suitable for use of sessionmaker(binds=db.get_binds(app)).
"""
app... |
Reflects tables from the database.
.. versionchanged:: 0.12
Parameters were added
def reflect(self, bind='__all__', app=None):
"""Reflects tables from the database.
.. versionchanged:: 0.12
Parameters were added
"""
self._execute_for_all_tables(app, bind,... |
Create and configure an instance of the Flask application.
def create_app(test_config=None):
"""Create and configure an instance of the Flask application."""
app = Flask(__name__, instance_relative_config=True)
# some deploy systems set the database url in the environ
db_url = os.environ.get("DATABASE... |
Calculate the negative Sharpe ratio of a portfolio
:param weights: asset weights of the portfolio
:type weights: np.ndarray
:param expected_returns: expected return of each asset
:type expected_returns: pd.Series
:param cov_matrix: the covariance matrix of asset returns
:type cov_matrix: pd.Dat... |
Calculate the volatility of a portfolio. This is actually a misnomer because
the function returns variance, which is technically the correct objective
function when minimising volatility.
:param weights: asset weights of the portfolio
:type weights: np.ndarray
:param cov_matrix: the covariance matr... |
Calculate the negative CVaR. Though we want the "min CVaR portfolio", we
actually need to maximise the expected return of the worst q% cases, thus
we need this value to be negative.
:param weights: asset weights of the portfolio
:type weights: np.ndarray
:param returns: asset returns
:type retu... |
Calculate annualised mean (daily) historical return from input (daily) asset prices.
:param prices: adjusted closing prices of the asset, each row is a date
and each column is a ticker/id.
:type prices: pd.DataFrame
:param frequency: number of time periods in a year, defaults to 252 (the... |
Calculate the exponentially-weighted mean of (daily) historical returns, giving
higher weight to more recent data.
:param prices: adjusted closing prices of the asset, each row is a date
and each column is a ticker/id.
:type prices: pd.DataFrame
:param frequency: number of time perio... |
Maximise the Sharpe Ratio. The result is also referred to as the tangency portfolio,
as it is the tangent to the efficient frontier curve that intercepts the risk-free
rate.
:param risk_free_rate: risk-free rate of borrowing/lending, defaults to 0.02
:type risk_free_rate: float, optiona... |
Minimise volatility.
:return: asset weights for the volatility-minimising portfolio
:rtype: dict
def min_volatility(self):
"""
Minimise volatility.
:return: asset weights for the volatility-minimising portfolio
:rtype: dict
"""
args = (self.cov_matrix, ... |
Optimise some objective function. While an implicit requirement is that the function
can be optimised via a quadratic optimiser, this is not enforced. Thus there is a
decent chance of silent failure.
:param objective_function: function which maps (weight, args) -> cost
:type objective_f... |
Calculate the Sharpe-maximising portfolio for a given volatility (i.e max return
for a target risk).
:param target_risk: the desired volatility of the resulting portfolio.
:type target_risk: float
:param risk_free_rate: risk-free rate of borrowing/lending, defaults to 0.02
:type... |
Calculate the 'Markowitz portfolio', minimising volatility for a given target return.
:param target_return: the desired return of the resulting portfolio.
:type target_return: float
:param market_neutral: whether the portfolio should be market neutral (weights sum to zero),
... |
After optimising, calculate (and optionally print) the performance of the optimal
portfolio. Currently calculates expected return, volatility, and the Sharpe ratio.
:param verbose: whether performance should be printed, defaults to False
:type verbose: bool, optional
:param risk_free_ra... |
After optimising, calculate (and optionally print) the performance of the optimal
portfolio. Currently calculates expected return, volatility, and the Sharpe ratio.
:param expected_returns: expected returns for each asset. Set to None if
optimising for volatility only.
:type ex... |
Helper method to clean the raw weights, setting any weights whose absolute
values are below the cutoff to zero, and rounding the rest.
:param cutoff: the lower bound, defaults to 1e-4
:type cutoff: float, optional
:param rounding: number of decimal places to round the weights, defaults ... |
Private method: process input bounds into a form acceptable by scipy.optimize,
and check the validity of said bounds.
:param test_bounds: minimum and maximum weight of an asset
:type test_bounds: tuple
:raises ValueError: if ``test_bounds`` is not a tuple of length two.
:raises ... |
For a long only portfolio, convert the continuous weights to a discrete allocation
in a greedy iterative approach. This can be thought of as a clever way to round
the continuous weights to an integer number of shares
:param weights: continuous weights generated from the ``efficient_frontier`` module
:t... |
For a long only portfolio, convert the continuous weights to a discrete allocation
using Mixed Integer Linear Programming. This can be thought of as a clever way to round
the continuous weights to an integer number of shares
:param weights: continuous weights generated from the ``efficient_frontier`` modul... |
For a long only portfolio, convert the continuous weights to a discrete
allocation using Mixed Integer Linear Programming. This function assumes
that we buy some asset based on value instead of shares, and there is a
limit of minimum value and increasing step.
:param weights: continuous weights generat... |
Find the portfolio weights that minimises the CVaR, via
Monte Carlo sampling from the return distribution.
:param s: number of bootstrap draws, defaults to 10000
:type s: int, optional
:param beta: "significance level" (i. 1 - q), defaults to 0.95
:type beta: float, optional
... |
Calculate the annualised sample covariance matrix of (daily) asset returns.
:param prices: adjusted closing prices of the asset, each row is a date
and each column is a ticker/id.
:type prices: pd.DataFrame
:param frequency: number of time periods in a year, defaults to 252 (the number
... |
Estimate the semicovariance matrix, i.e the covariance given that
the returns are less than the benchmark.
.. semicov = E([min(r_i - B, 0)] . [min(r_j - B, 0)])
:param prices: adjusted closing prices of the asset, each row is a date
and each column is a ticker/id.
:type prices: pd.D... |
Calculate the exponential covariance between two timeseries of returns.
:param X: first time series of returns
:type X: pd.Series
:param Y: second time series of returns
:type Y: pd.Series
:param span: the span of the exponential weighting function, defaults to 180
:type span: int, optional
... |
Estimate the exponentially-weighted covariance matrix, which gives
greater weight to more recent data.
:param prices: adjusted closing prices of the asset, each row is a date
and each column is a ticker/id.
:type prices: pd.DataFrame
:param span: the span of the exponential weighting... |
Calculate the minimum covariance determinant, an estimator of the covariance matrix
that is more robust to noise.
:param prices: adjusted closing prices of the asset, each row is a date
and each column is a ticker/id.
:type prices: pd.DataFrame
:param frequency: number of time period... |
Helper method which annualises the output of shrinkage calculations,
and formats the result into a dataframe
:param raw_cov_array: raw covariance matrix of daily returns
:type raw_cov_array: np.ndarray
:return: annualised covariance matrix
:rtype: pd.DataFrame
def format_and_an... |
Shrink a sample covariance matrix to the identity matrix (scaled by the average
sample variance). This method does not estimate an optimal shrinkage parameter,
it requires manual input.
:param delta: shrinkage parameter, defaults to 0.2.
:type delta: float, optional
:return: shr... |
Calculate the Ledoit-Wolf shrinkage estimate.
:return: shrunk sample covariance matrix
:rtype: np.ndarray
def ledoit_wolf(self):
"""
Calculate the Ledoit-Wolf shrinkage estimate.
:return: shrunk sample covariance matrix
:rtype: np.ndarray
"""
X = np.nan... |
Calculate the Oracle Approximating Shrinkage estimate
:return: shrunk sample covariance matrix
:rtype: np.ndarray
def oracle_approximating(self):
"""
Calculate the Oracle Approximating Shrinkage estimate
:return: shrunk sample covariance matrix
:rtype: np.ndarray
... |
Calculate the Constant-Correlation covariance matrix.
:return: shrunk sample covariance matrix
:rtype: np.ndarray
def shrink(self):
"""
Calculate the Constant-Correlation covariance matrix.
:return: shrunk sample covariance matrix
:rtype: np.ndarray
"""
... |
Calculate the Constant-Correlation covariance matrix.
:return: shrunk sample covariance matrix
:rtype: np.ndarray
def shrink(self):
"""
Calculate the Constant-Correlation covariance matrix.
:return: shrunk sample covariance matrix
:rtype: np.ndarray
"""
... |
Get the minimum variance solution
def min_volatility(self):
"""Get the minimum variance solution"""
if not self.w:
self.solve()
var = []
for w in self.w:
a = np.dot(np.dot(w.T, self.cov_matrix), w)
var.append(a)
# return min(var)**.5, self.w[v... |
Get the max Sharpe ratio portfolio
def max_sharpe(self):
"""Get the max Sharpe ratio portfolio"""
if not self.w:
self.solve()
# 1) Compute the local max SR portfolio between any two neighbor turning points
w_sr, sr = [], []
for i in range(len(self.w) - 1):
... |
Get the efficient frontier
def efficient_frontier(self, points):
"""Get the efficient frontier"""
mu, sigma, weights = [], [], []
# remove the 1, to avoid duplications
a = np.linspace(0, 1, points / len(self.w))[:-1]
b = list(range(len(self.w) - 1))
for i in b:
... |
Emit a SocketIO event.
This function emits a SocketIO event to one or more connected clients. A
JSON blob can be attached to the event as payload. This is a function that
can only be called from a SocketIO event handler, as in obtains some
information from the current client context. Example::
... |
Send a SocketIO message.
This function sends a simple SocketIO message to one or more connected
clients. The message can be a string or a JSON blob. This is a simpler
version of ``emit()``, which should be preferred. This is a function that
can only be called from a SocketIO event handler.
:param ... |
Join a room.
This function puts the user in a room, under the current namespace. The
user and the namespace are obtained from the event context. This is a
function that can only be called from a SocketIO event handler. Example::
@socketio.on('join')
def on_join(data):
username ... |
Leave a room.
This function removes the user from a room, under the current namespace.
The user and the namespace are obtained from the event context. Example::
@socketio.on('leave')
def on_leave(data):
username = session['username']
room = data['room']
leav... |
Close a room.
This function removes any users that are in the given room and then deletes
the room from the server.
:param room: The name of the room to close.
:param namespace: The namespace for the room. If not provided, the
namespace is obtained from the request context.
def ... |
Return a list of the rooms the client is in.
This function returns all the rooms the client has entered, including its
own room, assigned by the Socket.IO server.
:param sid: The session id of the client. If not provided, the client is
obtained from the request context.
:param namespac... |
Disconnect the client.
This function terminates the connection with the client. As a result of
this call the client will receive a disconnect event. Example::
@socketio.on('message')
def receive_message(msg):
if is_banned(session['username']):
disconnect()
... |
Decorator to register a SocketIO event handler.
This decorator must be applied to SocketIO event handlers. Example::
@socketio.on('my event', namespace='/chat')
def handle_my_custom_event(json):
print('received json: ' + str(json))
:param message: The name of t... |
Decorator to define a custom error handler for SocketIO events.
This decorator can be applied to a function that acts as an error
handler for a namespace. This handler will be invoked when a SocketIO
event handler raises an exception. The handler function must accept one
argument, which... |
Decorator to define a default error handler for SocketIO events.
This decorator can be applied to a function that acts as a default
error handler for any namespaces that do not have a specific handler.
Example::
@socketio.on_error_default
def error_handler(e):
... |
Register a SocketIO event handler.
``on_event`` is the non-decorator version of ``'on'``.
Example::
def on_foo_event(json):
print('received json: ' + str(json))
socketio.on_event('my event', on_foo_event, namespace='/chat')
:param message: The name of... |
Emit a server generated SocketIO event.
This function emits a SocketIO event to one or more connected clients.
A JSON blob can be attached to the event as payload. This function can
be used outside of a SocketIO event context, so it is appropriate to
use when the server is the originato... |
Send a server-generated SocketIO message.
This function sends a simple SocketIO message to one or more connected
clients. The message can be a string or a JSON blob. This is a simpler
version of ``emit()``, which should be preferred. This function can be
used outside of a SocketIO event... |
Run the SocketIO web server.
:param app: The Flask application instance.
:param host: The hostname or IP address for the server to listen on.
Defaults to 127.0.0.1.
:param port: The port number for the server to listen on. Defaults to
5000.
:par... |
Stop a running SocketIO web server.
This method must be called from a HTTP or SocketIO handler function.
def stop(self):
"""Stop a running SocketIO web server.
This method must be called from a HTTP or SocketIO handler function.
"""
if self.server.eio.async_mode == 'threading'... |
Start a background task using the appropriate async model.
This is a utility function that applications can use to start a
background task using the method that is compatible with the
selected async mode.
:param target: the target function to execute.
:param args: arguments to ... |
Dispatch an event to the proper handler method.
In the most common usage, this method is not overloaded by subclasses,
as it performs the routing of events to methods. However, this
method can be overriden if special dispatching rules are needed, or if
having a single method that catche... |
Emit a custom event to one or more connected clients.
def emit(self, event, data=None, room=None, include_self=True,
namespace=None, callback=None):
"""Emit a custom event to one or more connected clients."""
return self.socketio.emit(event, data, room=room,
... |
Send a message to one or more connected clients.
def send(self, data, room=None, include_self=True, namespace=None,
callback=None):
"""Send a message to one or more connected clients."""
return self.socketio.send(data, room=room, include_self=include_self,
... |
Close a room.
def close_room(self, room, namespace=None):
"""Close a room."""
return self.socketio.close_room(room=room,
namespace=namespace or self.namespace) |
Example of how to send server generated events to clients.
def background_thread():
"""Example of how to send server generated events to clients."""
count = 0
while True:
socketio.sleep(10)
count += 1
socketio.emit('my_response',
{'data': 'Server generated even... |
Update query status and send email notification to a user
def on_failure(self, exc, task_id, args, kwargs, einfo):
"""Update query status and send email notification to a user"""
super().on_failure(exc, task_id, args, kwargs, einfo)
if isinstance(exc, OperationRunDoesNotExist):
retu... |
Send email notification and a file, if requested to do so by a user
def on_success(self, retval, task_id, args, kwargs):
"""Send email notification and a file, if requested to do so by a user"""
super().on_success(retval, task_id, args, kwargs)
self._operation_run.on_success() |
Record the event async.
def record_event(self, event: Event) -> None:
"""
Record the event async.
"""
from polyaxon.celery_api import celery_app
from polyaxon.settings import EventsCeleryTasks
if not event.ref_id:
event.ref_id = self.get_ref_id()
ser... |
Return event types where use acted on an object.
The write events are events with actions:
* CREATED
* UPDATED
* DELETED
* RESUMED
* COPIED
* CLONED
* STOPPED
def user_write_events(self) -> List[str]:
"""Return event t... |
Return event types where use viewed a main object.
def user_view_events(self) -> List[str]:
"""Return event types where use viewed a main object."""
return [event_type for event_type, event in self.items if event.get_event_action()
== event_actions.VIEWED] |
Validates a "new" email address by checking if it is already used by other users.
def validate_new_email(email):
"""Validates a "new" email address by checking if it is already used by other users."""
email = normalize_email(email)
User = get_user_model() # noqa
if User.objects.filter(email=email).exi... |
Pod spec to be used to create pods for project: tensorboard, notebooks.
def get_project_pod_spec(volume_mounts,
volumes,
image,
command,
args,
ports,
env_vars=None,
... |
We memoize the access to this function in case a second call is made.
def get_object(self):
"""We memoize the access to this function in case a second call is made."""
if self._object:
return self._object
self._object = super().get_object()
if not self.AUDITOR_EVENT_TYPES:
... |
Initializes the endpoint with the context keys based on the passed
and/or based on the query parameters (request.GET).
def initialize_context(self, request: HttpRequest, *args, **kwargs) -> None:
"""
Initializes the endpoint with the context keys based on the passed
and/or based on the ... |
Mount an tmpfs volume to /dev/shm.
This will set /dev/shm size to half of the RAM of node.
By default, /dev/shm is very small, only 64MB.
Some experiments will fail due to lack of share memory,
such as some experiments running on Pytorch.
def get_shm_volumes():
"""
Mount an tmpfs volume to /dev... |
The last constants of the job in this experiment.
def last_job_statuses(self) -> List[str]:
"""The last constants of the job in this experiment."""
statuses = []
for status in self.jobs.values_list('status__status', flat=True):
if status is not None:
statuses.append(... |
Return a boolean indicating if the experiment has any running jobs
def has_running_jobs(self) -> bool:
""""Return a boolean indicating if the experiment has any running jobs"""
return self.jobs.exclude(status__status__in=ExperimentLifeCycle.DONE_STATUS).exists() |
Return request's 'X_POLYAXON_INTERNAL:' header, as a bytestring.
def get_internal_header(request: HttpRequest) -> str:
"""
Return request's 'X_POLYAXON_INTERNAL:' header, as a bytestring.
"""
return get_header(request=request, header_service=conf.get('HEADERS_INTERNAL')) |
Signal handling for sidecars logs.
def logs_sidecars_experiments(experiment_name: str,
experiment_uuid: str,
job_uuid: str,
log_lines: Optional[Union[str, Iterable[str]]]) -> None:
"""Signal handling for sidecars logs."""
... |
Signal handling for sidecars logs.
def logs_sidecars_jobs(job_uuid: str,
job_name: str,
log_lines: Optional[Union[str, Iterable[str]]]) -> None:
"""Signal handling for sidecars logs."""
handle_job_logs(job_uuid=job_uuid,
job_name=job_name,
... |
Signal handling for sidecars logs.
def logs_sidecars_builds(job_uuid: str,
job_name: str,
log_lines: Optional[Union[str, Iterable[str]]]) -> None:
"""Signal handling for sidecars logs."""
handle_build_job_logs(job_uuid=job_uuid,
job_na... |
One task ran (checked).
def is_checked(self) -> bool:
"""One task ran (checked)."""
if not self.redis_key_checked:
return False
value = self._red.get(self.redis_key_checked)
if not value:
return False
return True |
One task ran (checked), and one task has been delayed.
def is_delayed(self) -> bool:
"""One task ran (checked), and one task has been delayed."""
if not self.redis_key_delayed:
return False
value = self._red.get(self.redis_key_delayed)
if not value:
return False... |
This method connects to RabbitMQ, returning the connection handle.
When the connection is established, the on_connection_open method
will be invoked by pika.
:rtype: pika.SelectConnection
def connect(self):
"""This method connects to RabbitMQ, returning the connection handle.
W... |
This method is invoked by pika when the channel has been opened.
The channel object is passed in so we can make use of it.
Since the channel is now open, we'll declare the exchange to use.
:param pika.channel.Channel channel: The channel object
def on_channel_open(self, channel):
"""T... |
Setup the exchange on RabbitMQ by invoking the Exchange.Declare RPC
command. When it is complete, the on_exchange_declareok method will
be invoked by pika.
:param str|unicode exchange_name: The name of the exchange to declare
def setup_exchange(self, exchange_name):
"""Setup the exchan... |
Setup the queue on RabbitMQ by invoking the Queue.Declare RPC
command. When it is complete, the on_queue_declareok method will
be invoked by pika.
:param str|unicode queue_name: The name of the queue to declare.
def setup_queue(self, queue_name):
"""Setup the queue on RabbitMQ by invok... |
Method invoked by pika when the Queue.Declare RPC call made in
setup_queue has completed. In this method we will bind the queue
and exchange together with the routing key by issuing the Queue.Bind
RPC command. When this command is complete, the on_bindok method will
be invoked by pika.
... |
Invoked by pika when RabbitMQ sends a Basic.Cancel for a consumer
receiving messages.
:param pika.frame.Method method_frame: The Basic.Cancel frame
def on_consumer_cancelled(self, method_frame):
"""Invoked by pika when RabbitMQ sends a Basic.Cancel for a consumer
receiving messages.
... |
Acknowledge the message delivery from RabbitMQ by sending a
Basic.Ack RPC method for the delivery tag.
:param int delivery_tag: The delivery tag from the Basic.Deliver frame
def acknowledge_message(self, delivery_tag):
"""Acknowledge the message delivery from RabbitMQ by sending a
Basi... |
Invoked by pika when a message is delivered from RabbitMQ. The
channel is passed for your convenience. The basic_deliver object that
is passed in carries the exchange, routing key, delivery tag and
a redelivered flag for the message. The properties passed in is an
instance of BasicProper... |
Tell RabbitMQ that you would like to stop consuming by sending the
Basic.Cancel RPC command.
def stop_consuming(self):
"""Tell RabbitMQ that you would like to stop consuming by sending the
Basic.Cancel RPC command.
"""
if self._channel:
_logger.debug('Sending a Basic... |
Open a new channel with RabbitMQ by issuing the Channel.Open RPC
command. When RabbitMQ responds that the channel is open, the
on_channel_open callback will be invoked by pika.
def open_channel(self):
"""Open a new channel with RabbitMQ by issuing the Channel.Open RPC
command. When Rabb... |
Run the example consumer by connecting to RabbitMQ and then
starting the IOLoop to block and allow the SelectConnection to operate.
def run(self):
"""Run the example consumer by connecting to RabbitMQ and then
starting the IOLoop to block and allow the SelectConnection to operate.
"""
... |
Cleanly shutdown the connection to RabbitMQ by stopping the consumer
with RabbitMQ. When RabbitMQ confirms the cancellation, on_cancelok
will be invoked by pika, which will then closing the channel and
connection. The IOLoop is started again because this method is invoked
when CTRL-C is ... |
Renders both the subject and body templates in the given context.
Returns a tuple (subject, body) of the result.
def render_mail_template(subject_template, body_template, context):
"""
Renders both the subject and body templates in the given context.
Returns a tuple (subject, body) of the result.
"... |
Renders an email subject and body using the given templates and context,
then sends it to the given recipients list.
The emails are send one-by-one.
def send_mass_template_mail(subject_template, body_template, recipients, context=None):
"""
Renders an email subject and body using the given templates a... |
Similar to `send_mass_template_mail` this function renders the given templates
into email subjects and bodies.
The emails are send one-by-one.
def send_mass_user_template_mail(subject_template, body_template, users, context):
"""
Similar to `send_mass_template_mail` this function renders the given tem... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.