text stringlengths 81 112k |
|---|
Define a L2 regularizer.
Args:
weight: scale the loss by this factor.
scope: Optional scope for name_scope.
Returns:
a regularizer function.
def l2_regularizer(weight=1.0, scope=None):
"""Define a L2 regularizer.
Args:
weight: scale the loss by this factor.
scope: Optional scope for name... |
Define a L1L2 regularizer.
Args:
weight_l1: scale the L1 loss by this factor.
weight_l2: scale the L2 loss by this factor.
scope: Optional scope for name_scope.
Returns:
a regularizer function.
def l1_l2_regularizer(weight_l1=1.0, weight_l2=1.0, scope=None):
"""Define a L1L2 regularizer.
Arg... |
Define a L1Loss, useful for regularize, i.e. lasso.
Args:
tensor: tensor to regularize.
weight: scale the loss by this factor.
scope: Optional scope for name_scope.
Returns:
the L1 loss op.
def l1_loss(tensor, weight=1.0, scope=None):
"""Define a L1Loss, useful for regularize, i.e. lasso.
Ar... |
Define a L2Loss, useful for regularize, i.e. weight decay.
Args:
tensor: tensor to regularize.
weight: an optional weight to modulate the loss.
scope: Optional scope for name_scope.
Returns:
the L2 loss op.
def l2_loss(tensor, weight=1.0, scope=None):
"""Define a L2Loss, useful for regularize, ... |
Define a Cross Entropy loss using softmax_cross_entropy_with_logits.
It can scale the loss by weight factor, and smooth the labels.
Args:
logits: [batch_size, num_classes] logits outputs of the network .
one_hot_labels: [batch_size, num_classes] target one_hot_encoded labels.
label_smoothing: if great... |
Stores the default arguments for the given set of list_ops.
For usage, please see examples at top of the file.
Args:
list_ops_or_scope: List or tuple of operations to set argument scope for or
a dictionary containg the current scope. When list_ops_or_scope is a dict,
kwargs must be empty. When lis... |
Decorates a function with args so it can be used within an arg_scope.
Args:
func: function to decorate.
Returns:
A tuple with the decorated function func_with_args().
def add_arg_scope(func):
"""Decorates a function with args so it can be used within an arg_scope.
Args:
func: function to decorat... |
Returns this executor's "singleton" instance of the multiprocessing.Manager, reconnecting per python-worker if needed.
Args:
:cluster_info: cluster node reservations
:host: host IP address
:executor_id: unique id per executor (created during initial call to run())
Returns:
TFManager instance for t... |
Wraps the user-provided TensorFlow main function in a Spark mapPartitions function.
Args:
:fn: TensorFlow "main" function provided by the user.
:tf_args: ``argparse`` args, or command line ``ARGV``. These will be passed to the ``fn``.
:cluster_meta: dictionary of cluster metadata (e.g. cluster_id, reser... |
Feeds Spark partitions into the shared multiprocessing.Queue.
Args:
:cluster_info: node reservation information for the cluster (e.g. host, executor_id, pid, ports, etc)
:cluster_meta: dictionary of cluster metadata (e.g. cluster_id, reservation.Server address, etc)
:feed_timeout: number of seconds after... |
Feeds Spark partitions into the shared multiprocessing.Queue and returns inference results.
Args:
:cluster_info: node reservation information for the cluster (e.g. host, executor_id, pid, ports, etc)
:feed_timeout: number of seconds after which data feeding times out (600 sec default)
:qname: *INTERNAL_U... |
Stops all TensorFlow nodes by feeding ``None`` into the multiprocessing.Queues.
Args:
:cluster_info: node reservation information for the cluster (e.g. host, executor_id, pid, ports, etc).
:queues: *INTERNAL_USE*
Returns:
A nodeRDD.mapPartitions() function
def shutdown(cluster_info, queues=['input'])... |
Convenience function to access ``TFNode.start_cluster_server`` directly from this object instance.
def start_cluster_server(self, num_gpus=1, rdma=False):
"""Convenience function to access ``TFNode.start_cluster_server`` directly from this object instance."""
return TFNode.start_cluster_server(self, num_gpus, ... |
Convenience function to access ``TFNode.export_saved_model`` directly from this object instance.
def export_saved_model(self, sess, export_dir, tag_set, signatures):
"""Convenience function to access ``TFNode.export_saved_model`` directly from this object instance."""
TFNode.export_saved_model(sess, export_dir... |
Convenience function to access ``TFNode.DataFeed`` directly from this object instance.
def get_data_feed(self, train_mode=True, qname_in='input', qname_out='output', input_mapping=None):
"""Convenience function to access ``TFNode.DataFeed`` directly from this object instance."""
return TFNode.DataFeed(self.mgr... |
Downloads data from url, and makes changes to match the CSV format.
def _download_and_clean_file(filename, url):
"""Downloads data from url, and makes changes to match the CSV format."""
temp_file, _ = urllib.request.urlretrieve(url)
with tf.gfile.Open(temp_file, 'r') as temp_eval_file:
with tf.gfile.Open(fi... |
Download census data if it is not already present.
def download(data_dir):
"""Download census data if it is not already present."""
tf.gfile.MakeDirs(data_dir)
training_file_path = os.path.join(data_dir, TRAINING_FILE)
if not tf.gfile.Exists(training_file_path):
_download_and_clean_file(training_file_path... |
Builds a set of wide and deep feature columns.
def build_model_columns():
"""Builds a set of wide and deep feature columns."""
# Continuous variable columns
age = tf.feature_column.numeric_column('age')
education_num = tf.feature_column.numeric_column('education_num')
capital_gain = tf.feature_column.numeric... |
Generate an input function for the Estimator.
def input_fn(data_file, num_epochs, shuffle, batch_size):
"""Generate an input function for the Estimator."""
assert tf.gfile.Exists(data_file), (
'%s not found. Please make sure you have run census_dataset.py and '
'set the --data_dir argument to the corre... |
Receive a message on ``sock``.
def receive(self, sock):
"""Receive a message on ``sock``."""
msg = None
data = b''
recv_done = False
recv_len = -1
while not recv_done:
buf = sock.recv(BUFSIZE)
if buf is None or len(buf) == 0:
raise Exception("socket closed")
if recv_le... |
Send ``msg`` to destination ``sock``.
def send(self, sock, msg):
"""Send ``msg`` to destination ``sock``."""
data = pickle.dumps(msg)
buf = struct.pack('>I', len(data)) + data
sock.sendall(buf) |
Block until all reservations are received.
def await_reservations(self, sc, status={}, timeout=600):
"""Block until all reservations are received."""
timespent = 0
while not self.reservations.done():
logging.info("waiting for {0} reservations".format(self.reservations.remaining()))
# check stat... |
Start listener in a background thread
Returns:
address of the Server as a tuple of (host, port)
def start(self):
"""Start listener in a background thread
Returns:
address of the Server as a tuple of (host, port)
"""
server_sock = self.start_listening_socket()
# hostname may not b... |
Helper function to wrap msg w/ msg_type.
def _request(self, msg_type, msg_data=None):
"""Helper function to wrap msg w/ msg_type."""
msg = {}
msg['type'] = msg_type
if msg_data:
msg['data'] = msg_data
done = False
tries = 0
while not done and tries < MAX_RETRIES:
try:
M... |
Poll until all reservations completed, then return cluster_info.
def await_reservations(self):
"""Poll until all reservations completed, then return cluster_info."""
done = False
while not done:
done = self._request('QUERY')
time.sleep(1)
return self.get_reservations() |
Serializes an image/label as a TFExample byte string
def toTFExample(image, label):
"""Serializes an image/label as a TFExample byte string"""
example = tf.train.Example(
features=tf.train.Features(
feature={
'label': tf.train.Feature(int64_list=tf.train.Int64List(value=label.astype("int64"))),
... |
Deserializes a TFExample from a byte string
def fromTFExample(bytestr):
"""Deserializes a TFExample from a byte string"""
example = tf.train.Example()
example.ParseFromString(bytestr)
return example |
Writes MNIST image/label vectors into parallelized files on HDFS
def writeMNIST(sc, input_images, input_labels, output, format, num_partitions):
"""Writes MNIST image/label vectors into parallelized files on HDFS"""
# load MNIST gzip into memory
with open(input_images, 'rb') as f:
images = numpy.array(mnist.... |
Reads/verifies previously created output
def readMNIST(sc, output, format):
"""Reads/verifies previously created output"""
output_images = output + "/images"
output_labels = output + "/labels"
imageRDD = None
labelRDD = None
if format == "pickle":
imageRDD = sc.pickleFile(output_images)
labelRDD ... |
Build Inception v3 model architecture.
See here for reference: http://arxiv.org/abs/1512.00567
Args:
images: Images returned from inputs() or distorted_inputs().
num_classes: number of classes
for_training: If set to `True`, build the inference model for training.
Kernels that operate differentl... |
Adds all losses for the model.
Note the final loss is not returned. Instead, the list of losses are collected
by slim.losses. The losses are accumulated in tower_loss() and summed to
calculate the total loss.
Args:
logits: List of logits from inference(). Each entry is a 2-D float Tensor.
labels: Labe... |
Convenience function to create a Tensorflow-compatible absolute HDFS path from relative paths
Args:
:ctx: TFNodeContext containing the metadata specific to this node in the cluster.
:path: path to convert
Returns:
An absolute path prefixed with the correct filesystem scheme.
def hdfs_path(ctx, path):... |
Function that wraps the creation of TensorFlow ``tf.train.Server`` for a node in a distributed TensorFlow cluster.
This is intended to be invoked from within the TF ``map_fun``, replacing explicit code to instantiate ``tf.train.ClusterSpec``
and ``tf.train.Server`` objects.
Args:
:ctx: TFNodeContext contain... |
Convenience function to export a saved_model using provided arguments
The caller specifies the saved_model signatures in a simplified python dictionary form, as follows::
signatures = {
'signature_def_key': {
'inputs': { 'input_tensor_alias': input_tensor_name },
'outputs': { 'output_tenso... |
Gets a batch of items from the input RDD.
If multiple tensors are provided per row in the input RDD, e.g. tuple of (tensor1, tensor2, ..., tensorN) and:
* no ``input_mapping`` was provided to the DataFeed constructor, this will return an array of ``batch_size`` tuples,
and the caller is responsible for ... |
Push a batch of output results to the Spark output RDD of ``TFCluster.inference()``.
Note: this currently expects a one-to-one mapping of input to output data, so the length of the ``results`` array should match the length of
the previously retrieved batch of input data.
Args:
:results: array of out... |
Terminate data feeding early.
Since TensorFlow applications can often terminate on conditions unrelated to the training data (e.g. steps, accuracy, etc),
this method signals the data feeding process to ignore any further incoming data. Note that Spark itself does not have a mechanism
to terminate an RDD o... |
Define/export a single-node TF graph for inferencing
def export_fun(args):
"""Define/export a single-node TF graph for inferencing"""
# Input placeholder for inferencing
x = tf.placeholder(tf.float32, [None, IMAGE_PIXELS * IMAGE_PIXELS], name="x")
# Variables of the hidden layer
hid_w = tf.Variable(tf.trunc... |
Train Inception on a dataset for a number of steps.
def train(target, dataset, cluster_spec, ctx):
"""Train Inception on a dataset for a number of steps."""
# Number of workers and parameter servers are infered from the workers and ps
# hosts string.
num_workers = len(cluster_spec.as_dict()['worker'])
num_pa... |
Evaluate model on Dataset for a number of steps.
def export(_):
FLAGS = tf.app.flags.FLAGS
"""Evaluate model on Dataset for a number of steps."""
#with tf.Graph().as_default():
tf.reset_default_graph()
def preprocess_image(image_buffer):
"""Preprocess JPEG encoded bytes to 3D float Tensor."""
# De... |
*DEPRECATED*. Allocates first available GPU using cudaSetDevice(), or returns 0 otherwise.
def _get_gpu():
"""*DEPRECATED*. Allocates first available GPU using cudaSetDevice(), or returns 0 otherwise."""
# Note: this code executes, but Tensorflow subsequently complains that the "current context was not created by ... |
Get list of free GPUs according to nvidia-smi.
This will retry for ``MAX_RETRIES`` times until the requested number of GPUs are available.
Args:
:num_gpu: number of GPUs desired.
:worker_index: index "hint" for allocation of available GPUs.
Returns:
Comma-delimited string of GPU ids, or raises an E... |
Get available GPUs according to utilization thresholds.
Args:
:max_gpu_utilization: percent utilization threshold to consider a GPU "free"
:min_free_memory: percent free memory to consider a GPU "free"
:num_gpu: number of requested GPUs
Returns:
A tuple of (available_gpus, minimum_free_memory), wh... |
Build an Example proto for an example.
Args:
filename: string, path to an image file, e.g., '/path/to/example.JPG'
image_buffer: string, JPEG encoding of RGB image
label: integer, identifier for the ground truth for the network
text: string, unique human-readable, e.g. 'dog'
height: integer, imag... |
Processes and saves list of images as TFRecord in 1 thread.
Args:
coder: instance of ImageCoder to provide TensorFlow image coding utils.
thread_index: integer, unique batch to run index is within [0, len(ranges)).
ranges: list of pairs of integers specifying ranges of each batches to
analyze in pa... |
Process and save list of images as TFRecord of Example protos.
Args:
name: string, unique identifier specifying the data set
filenames: list of strings; each string is a path to an image file
texts: list of strings; each string is human readable, e.g. 'dog'
labels: list of integer; each integer ident... |
Build a list of all images files and labels in the data set.
Args:
data_dir: string, path to the root directory of images.
Assumes that the image data set resides in JPEG files located in
the following directory structure.
data_dir/dog/another-image.JPEG
data_dir/dog/my-image.jpg
... |
Process a complete data set and save it as a TFRecord.
Args:
name: string, unique identifier specifying the data set.
directory: string, root path to the data set.
num_shards: integer number of shards for this data set.
labels_file: string, path to the labels file.
def _process_dataset(name, directo... |
Generate batches of ImageNet images for evaluation.
Use this function as the inputs for evaluating a network.
Note that some (minimal) image preprocessing occurs during evaluation
including central cropping and resizing of the image to fit the network.
Args:
dataset: instance of Dataset class specifying ... |
Generate batches of distorted versions of ImageNet images.
Use this function as the inputs for training a network.
Distorting images provides a useful technique for augmenting the data
set during training in order to make the network invariant to aspects
of the image that do not effect the label.
Args:
... |
Decode a JPEG string into one 3-D float image Tensor.
Args:
image_buffer: scalar string Tensor.
scope: Optional scope for name_scope.
Returns:
3-D float Tensor with values ranging from [0, 1).
def decode_jpeg(image_buffer, scope=None):
"""Decode a JPEG string into one 3-D float image Tensor.
Args... |
Distort the color of the image.
Each color distortion is non-commutative and thus ordering of the color ops
matters. Ideally we would randomly permute the ordering of the color ops.
Rather then adding that level of complication, we select a distinct ordering
of color ops for each preprocessing thread.
Args:... |
Distort one image for training a network.
Distorting images provides a useful technique for augmenting the data
set during training in order to make the network invariant to aspects
of the image that do not effect the label.
Args:
image: 3-D float Tensor of image
height: integer
width: integer
... |
Prepare one image for evaluation.
Args:
image: 3-D float Tensor
height: integer
width: integer
scope: Optional scope for name_scope.
Returns:
3-D float Tensor of prepared image.
def eval_image(image, height, width, scope=None):
"""Prepare one image for evaluation.
Args:
image: 3-D flo... |
Decode and preprocess one image for evaluation or training.
Args:
image_buffer: JPEG encoded string Tensor
bbox: 3-D float Tensor of bounding boxes arranged [1, num_boxes, coords]
where each coordinate is [0, 1) and the coordinates are arranged as
[ymin, xmin, ymax, xmax].
train: boolean
... |
Parses an Example proto containing a training example of an image.
The output of the build_image_data.py image preprocessing script is a dataset
containing serialized Example protocol buffers. Each Example proto contains
the following fields:
image/height: 462
image/width: 581
image/colorspace: 'RGB... |
Contruct batches of training or evaluation examples from the image dataset.
Args:
dataset: instance of Dataset class specifying the dataset.
See dataset.py for details.
batch_size: integer
train: boolean
num_preprocess_threads: integer, total number of preprocessing threads
num_readers: int... |
Download external libraries from PyPI to SPARK_EC2_DIR/lib/ and prepend them to our PATH.
def setup_external_libs(libs):
"""
Download external libraries from PyPI to SPARK_EC2_DIR/lib/ and prepend them to our PATH.
"""
PYPI_URL_PREFIX = "https://pypi.python.org/packages/source"
SPARK_EC2_LIB_DIR = ... |
Get the EC2 instances in an existing cluster if available.
Returns a tuple of lists of EC2 instance objects for the masters and slaves.
def get_existing_cluster(conn, opts, cluster_name, die_on_error=True):
"""
Get the EC2 instances in an existing cluster if available.
Returns a tuple of lists of EC2 i... |
Check if SSH is available on a host.
def is_ssh_available(host, opts, print_ssh_output=True):
"""
Check if SSH is available on a host.
"""
s = subprocess.Popen(
ssh_command(opts) + ['-t', '-t', '-o', 'ConnectTimeout=3',
'%s@%s' % (opts.user, host), stringify_command... |
Check if SSH is available on all the instances in a cluster.
def is_cluster_ssh_available(cluster_instances, opts):
"""
Check if SSH is available on all the instances in a cluster.
"""
for i in cluster_instances:
dns_name = get_dns_name(i, opts.private_ips)
if not is_ssh_available(host=... |
Wait for all the instances in the cluster to reach a designated state.
cluster_instances: a list of boto.ec2.instance.Instance
cluster_state: a string representing the desired state of all the instances in the cluster
value can be 'ssh-ready' or a valid value from boto.ec2.instance.InstanceState suc... |
Instruction to download and extract the tarball from Flowers website.
def download_message(self):
"""Instruction to download and extract the tarball from Flowers website."""
print('Failed to find any ImageNet %s files'% self.subset)
print('')
print('If you have already downloaded and processed the dat... |
Add supervised learning flags, as well as wide-deep model type.
def define_wide_deep_flags():
"""Add supervised learning flags, as well as wide-deep model type."""
flags_core.define_base()
flags_core.define_benchmark()
flags_core.define_performance(
num_parallel_calls=False, inter_op=True, intra_op=True,... |
Export to SavedModel format.
Args:
model: Estimator object
model_type: string indicating model type. "wide", "deep" or "wide_deep"
export_dir: directory to export the model.
model_column_fn: Function to generate model feature columns.
def export_model(model, model_type, export_dir, model_column_fn):... |
Define training loop.
def run_loop(name, train_input_fn, eval_input_fn, model_column_fn,
build_estimator_fn, flags_obj, tensors_to_log, early_stop=False):
"""Define training loop."""
model_helpers.apply_clean(flags.FLAGS)
model = build_estimator_fn(
model_dir=flags_obj.model_dir, model_type=fl... |
Calculate the total loss on a single tower running the ImageNet model.
We perform 'batch splitting'. This means that we cut up a batch across
multiple GPU's. For instance, if the batch size = 32 and num_gpus = 2,
then each tower will operate on an batch of 16 images.
Args:
images: Images. 4D tensor of siz... |
Train on dataset for a number of steps.
def train(dataset):
"""Train on dataset for a number of steps."""
with tf.Graph().as_default(), tf.device('/cpu:0'):
# Create a variable to count the number of train() calls. This equals the
# number of batches processed * FLAGS.num_gpus.
global_step = tf.get_var... |
Adds a Batch Normalization layer.
Args:
inputs: a tensor of size [batch_size, height, width, channels]
or [batch_size, channels].
decay: decay for the moving average.
center: If True, subtract beta. If False, beta is not created and ignored.
scale: If True, multiply by gamma. If False, ga... |
Converts `int_or_tuple` to height, width.
Several of the functions that follow accept arguments as either
a tuple of 2 integers or a single integer. A single integer
indicates that the 2 values of the tuple are the same.
This functions normalizes the input value by always returning a tuple.
Args:
int_... |
Adds a 2D convolution followed by an optional batch_norm layer.
conv2d creates a variable called 'weights', representing the convolutional
kernel, that is convolved with the input. If `batch_norm_params` is None, a
second variable called 'biases' is added to the result of the convolution
operation.
Args:
... |
Adds a fully connected layer followed by an optional batch_norm layer.
FC creates a variable called 'weights', representing the fully connected
weight matrix, that is multiplied by the input. If `batch_norm` is None, a
second variable called 'biases' is added to the result of the initial
vector-matrix multipli... |
Transform numeric labels into onehot_labels.
Args:
labels: [batch_size] target labels.
num_classes: total number of classes.
scope: Optional scope for name_scope.
Returns:
one hot encoding of the labels.
def one_hot_encoding(labels, num_classes, scope=None):
"""Transform numeric labels into oneh... |
Adds a Max Pooling layer.
It is assumed by the wrapper that the pooling is only done per image and not
in depth or batch.
Args:
inputs: a tensor of size [batch_size, height, width, depth].
kernel_size: a list of length 2: [kernel_height, kernel_width] of the
pooling kernel over which the op is com... |
Returns a dropout layer applied to the input.
Args:
inputs: the tensor to pass to the Dropout layer.
keep_prob: the probability of keeping each input unit.
is_training: whether or not the model is in training mode. If so, dropout is
applied and values scaled. Otherwise, inputs is returned.
scope:... |
Flattens the input while maintaining the batch_size.
Assumes that the first dimension represents the batch.
Args:
inputs: a tensor of size [batch_size, ...].
scope: Optional scope for name_scope.
Returns:
a flattened tensor with shape [batch_size, k].
Raises:
ValueError: if inputs.shape is ... |
Build a sequential Tower starting from inputs by using an op repeatedly.
It creates new scopes for each operation by increasing the counter.
Example: given repeat_op(3, _, ops.conv2d, 64, [3, 3], scope='conv1')
it will repeat the given op under the following variable_scopes:
conv1/Conv
conv1/Conv_1... |
Wraps a given RPC function by producing an awaitable function suitable to be run in the asyncio
event loop. The wrapped function catches all unhandled exceptions and reports them to the exception
future, which consumers can await upon to listen for unhandled exceptions.
The wrapped function als... |
registerResource registers a new resource object with a given type t and name. It returns the auto-generated
URN and the ID that will resolve after the deployment has completed. All properties will be initialized to property
objects that the registration operation will resolve at the right time (or remain unr... |
Configure sets the current ambient settings bag to the one given.
def configure(settings: Settings):
"""
Configure sets the current ambient settings bag to the one given.
"""
if not settings or not isinstance(settings, Settings):
raise TypeError('Settings is expected to be non-None and of type ... |
Returns the current project name.
def get_project() -> Optional[str]:
"""
Returns the current project name.
"""
project = SETTINGS.project
if not project:
require_test_mode_enabled()
raise RunError('Missing project name; for test mode, please set PULUMI_NODEJS_PROJECT')
return p... |
Returns the current stack name.
def get_stack() -> Optional[str]:
"""
Returns the current stack name.
"""
stack = SETTINGS.stack
if not stack:
require_test_mode_enabled()
raise RunError('Missing stack name; for test mode, please set PULUMI_NODEJS_STACK')
return stack |
Returns the current resource monitoring service client for RPC communications.
def get_monitor() -> Optional[resource_pb2_grpc.ResourceMonitorStub]:
"""
Returns the current resource monitoring service client for RPC communications.
"""
monitor = SETTINGS.monitor
if not monitor:
require_test... |
Serializes an arbitrary Input bag into a Protobuf structure, keeping track of the list
of dependent resources in the `deps` list. Serializing properties is inherently async
because it awaits any futures that are contained transitively within the input bag.
async def serialize_properties(inputs: 'Inputs',
... |
Serializes a single Input into a form suitable for remoting to the engine, awaiting
any futures required to do so.
async def serialize_property(value: 'Input[Any]',
deps: List['Resource'],
input_transformer: Optional[Callable[[str], str]] = None) -> Any:
... |
Deserializes a protobuf `struct_pb2.Struct` into a Python dictionary containing normal
Python types.
def deserialize_properties(props_struct: struct_pb2.Struct) -> Any:
"""
Deserializes a protobuf `struct_pb2.Struct` into a Python dictionary containing normal
Python types.
"""
# Check out this ... |
Deserializes a single protobuf value (either `Struct` or `ListValue`) into idiomatic
Python values.
def deserialize_property(value: Any) -> Any:
"""
Deserializes a single protobuf value (either `Struct` or `ListValue`) into idiomatic
Python values.
"""
if value == UNKNOWN:
return None
... |
Recursively rewrite keys of objects returned by the engine to conform with a naming
convention specified by the resource's implementation of `translate_output_property`.
If output is a `dict`, every key is translated using `translate_output_property` while every value is transformed
by recursing.
If o... |
Resolves all outputs with resolvers exceptionally, using the given exception as the reason why the resolver has
failed to resolve.
:param resolvers: Resolvers associated with a resource's outputs.
:param exn: The exception that occured when trying (and failing) to create this resource.
def resolve_outputs... |
Returns an optional configuration value by its key, or None if it doesn't exist.
:param str key: The requested configuration key.
:return: The configuration key's value, or None if one does not exist.
:rtype: Optional[str]
def get(self, key: str) -> Optional[str]:
"""
Returns a... |
Returns an optional configuration value, as a bool, by its key, or None if it doesn't exist.
If the configuration value isn't a legal boolean, this function will throw an error.
:param str key: The requested configuration key.
:return: The configuration key's value, or None if one does not exis... |
Returns an optional configuration value, as an int, by its key, or None if it doesn't exist.
If the configuration value isn't a legal int, this function will throw an error.
:param str key: The requested configuration key.
:return: The configuration key's value, or None if one does not exist.
... |
Returns an optional configuration value, as a float, by its key, or None if it doesn't exist.
If the configuration value isn't a legal float, this function will throw an error.
:param str key: The requested configuration key.
:return: The configuration key's value, or None if one does not exist... |
Returns a configuration value by its given key. If it doesn't exist, an error is thrown.
:param str key: The requested configuration key.
:return: The configuration key's value.
:rtype: str
:raises ConfigMissingError: The configuration value did not exist.
def require(self, key: str) ... |
Returns a configuration value, as a bool, by its given key. If it doesn't exist, or the
configuration value is not a legal bool, an error is thrown.
:param str key: The requested configuration key.
:return: The configuration key's value.
:rtype: bool
:raises ConfigMissingError:... |
Returns a configuration value, as an int, by its given key. If it doesn't exist, or the
configuration value is not a legal int, an error is thrown.
:param str key: The requested configuration key.
:return: The configuration key's value.
:rtype: int
:raises ConfigMissingError: T... |
Returns a configuration value, as a float, by its given key. If it doesn't exist, or the
configuration value is not a legal number, an error is thrown.
:param str key: The requested configuration key.
:return: The configuration key's value.
:rtype: float
:raises ConfigMissingEr... |
Decorator to annotate the Asset class. Registers the decorated class
as the Asset known type.
def asset(class_obj: type) -> type:
"""
Decorator to annotate the Asset class. Registers the decorated class
as the Asset known type.
"""
assert isinstance(class_obj, type), "class_obj is not a Class"
... |
Decorator to annotate the FileAsset class. Registers the decorated class
as the FileAsset known type.
def file_asset(class_obj: type) -> type:
"""
Decorator to annotate the FileAsset class. Registers the decorated class
as the FileAsset known type.
"""
assert isinstance(class_obj, type), "class... |
Decorator to annotate the StringAsset class. Registers the decorated class
as the StringAsset known type.
def string_asset(class_obj: type) -> type:
"""
Decorator to annotate the StringAsset class. Registers the decorated class
as the StringAsset known type.
"""
assert isinstance(class_obj, typ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.