Client Library Reference
This section contains Client Library classes, methods, and attributes myst-alpha 0.21.0
function authenticate_with_service_account
authenticate_with_service_account
authenticate_with_service_account(
key_file_path: Optional[pathlib.Path] = None
) → None
Authenticates the global client with service account credentials.
Args:
key_file_path
: absolute path to service account key file; if this is not given, this will look for the key file path in theMYST_APPLICATION_CREDENTIALS
environment variable
function authenticate
authenticate
authenticate(
credentials: Optional[myst.auth.credentials.Credentials] = None,
use_console: bool = False,
use_cache: bool = True
) → None
Authenticates the global client with user credentials.
Args:
credentials
: custom credentials to use instead of getting credentials from user account; if provided, this method will prefer these over other authentication methodsuse_console
: whether or not to use the console for the user account authorization flowuse_cache
: whether or not to reuse cached user credentials
class Client
Client
HTTP client for interacting with the Myst Platform API.
method Client.**init**
Client.**init**
__init__(
credentials: Optional[myst.auth.credentials.Credentials] = None,
timeout: Optional[int] = None,
api_host: Optional[str] = None
)
A wrapper object providing convenient API access with credentials.
property Client.user_agent
Gets the User-Agent
header string to send to the Myst API.
method Client.authenticate
Client.authenticate
authenticate(credentials: myst.auth.credentials.Credentials) → None
Authenticates this client using the given credentials.
method Client.request
Client.request
request(
method: str,
path: str,
response_class: Type[~ResponseModelType],
params: Optional[Dict[str, Any]] = None,
request_model: Optional[~RequestModelType] = None
) → ~ResponseModelType
Executes a request for the given HTTP method and URL, handling JSON serialization and deserialization.
Args:
method
: HTTP verb to execute, e.g. "GET", "POST", etc.path
: path relative to the base URL, e.g. "/time_series/"response_class
: name of the model class to parse the response content intoparams
: HTTP query parametersrequest_model
: JSON-able model instance to pass in request body
Raises:
MystClientError
: client error (HTTP 4xx), including further details in the case of 422MystAPIError
: server error (HTTP 500) or unrecognized errorNotFound
: client error (HTTP 404)
Returns:
parsed and validated instance of indicated response class
function get_client
get_client
get_client() → Client
Returns the global Myst client instance.
function set_client
set_client
set_client(client: myst.client.Client) → None
Sets the global Myst client instance.
Useful for e.g. configuring timeouts globally.
Args:
client
: the client to use
class Backtest
Backtest
property Backtest.state
Returns the state of the backtest from the latest backtest job.
classmethod Backtest.create
Backtest.create
create(
project: Union[myst.resources.project.Project, str, uuid.UUID],
title: str,
model: Union[myst.resources.model.Model, str, uuid.UUID],
test_start_time: myst.core.time.time.Time,
test_end_time: myst.core.time.time.Time,
fit_start_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming],
fit_end_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming],
fit_reference_timing: Union[myst.models.timing.AbsoluteTiming, myst.models.timing.CronTiming],
predict_start_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming],
predict_end_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming],
predict_reference_timing: myst.models.timing.CronTiming,
description: Optional[str] = None
) → Backtest
Creates a new backtest.
classmethod Backtest.get
Backtest.get
get(
project: Union[myst.resources.project.Project, str, uuid.UUID],
uuid: Union[str, uuid.UUID]
) → Backtest
Gets a backtest by its identifier.
method Backtest.get_job
Backtest.get_job
get_job() → BacktestJob
Gets the latest job associated with this backtest.
Returns:
the backtest job
Raises:
ValueError
: if the job uuid cannot be inferred from a recent run
method Backtest.get_result
Backtest.get_result
get_result() → BacktestResult
Gets the latest result associated with a job for this backtest.
Returns:
the backtest result
Raises:
ValueError
: if the job uuid cannot be inferred from a recent run
classmethod Backtest.list
Backtest.list
list(
project: Union[myst.resources.project.Project, str, uuid.UUID]
) → List[ForwardRef('Backtest')]
Lists all backtests associated with this project.
method Backtest.run
Backtest.run
run() → BacktestJob
Runs the backtest.
method Backtest.update
Backtest.update
update(
title: Union[str, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
model: Union[myst.resources.model.Model, str, uuid.UUID, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
test_start_time: Union[myst.core.time.time.Time, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
test_end_time: Union[myst.core.time.time.Time, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
fit_start_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
fit_end_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
fit_reference_timing: Union[myst.models.timing.AbsoluteTiming, myst.models.timing.CronTiming, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
predict_start_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
predict_end_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
predict_reference_timing: Union[myst.models.timing.CronTiming, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
description: Union[str, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>
) → Backtest
Updates a new backtest.
method Backtest.wait_until_completed
Backtest.wait_until_completed
wait_until_completed() → None
Returns the backtest job once it has completed.
class HPO
HPO
property HPO.state
Returns the state of the HPO from the latest HPO job.
classmethod HPO.create
HPO.create
create(
project: Union[ForwardRef('Project'), str, uuid.UUID],
title: str,
model: Union[ForwardRef('Model'), str, uuid.UUID],
test_start_time: myst.core.time.time.Time,
test_end_time: myst.core.time.time.Time,
fit_start_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming],
fit_end_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming],
fit_reference_timing: Union[myst.models.timing.AbsoluteTiming, myst.models.timing.CronTiming],
predict_start_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming],
predict_end_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming],
predict_reference_timing: myst.models.timing.CronTiming,
search_algorithm: myst.resources.hpo.Hyperopt,
search_space: Dict[str, Optional[myst.resources.hpo.Uniform, myst.resources.hpo.QUniform, myst.resources.hpo.LogUniform, myst.resources.hpo.QLogUniform]],
description: Optional[str] = None
) → HPO
Creates a new HPO.
classmethod HPO.get
HPO.get
get(
project: Union[ForwardRef('Project'), str, uuid.UUID],
uuid: Union[str, uuid.UUID]
) → HPO
Gets a HPO by its identifier.
method HPO.get_job
HPO.get_job
get_job() → HPOJob
Gets the latest job associated with this HPO.
Returns:
the HPO job
Raises:
ValueError
: if the job uuid cannot be inferred from a recent run
method HPO.get_result
HPO.get_result
get_result() → HPOResult
Gets the latest result associated with a job for this HPO.
Returns:
the HPO result
Raises:
ValueError
: if the job state is notSUCCESS
classmethod HPO.list
HPO.list
list(
project: Union[ForwardRef('Project'), str, uuid.UUID]
) → List[ForwardRef('HPO')]
Lists all HPOs associated with this project.
method HPO.run
HPO.run
run() → HPOJob
Runs the HPO.
method HPO.update
HPO.update
update(
title: Union[str, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
model: Union[myst.resources.model.Model, str, uuid.UUID, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
test_start_time: Union[myst.core.time.time.Time, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
test_end_time: Union[myst.core.time.time.Time, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
fit_start_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
fit_end_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
fit_reference_timing: Union[myst.models.timing.AbsoluteTiming, myst.models.timing.CronTiming, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
predict_start_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
predict_end_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
predict_reference_timing: Union[myst.models.timing.CronTiming, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
search_algorithm: Union[myst.resources.hpo.Hyperopt, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
search_space: Optional[Dict[str, Union[myst.resources.hpo.Uniform, myst.resources.hpo.QUniform, myst.resources.hpo.LogUniform, myst.resources.hpo.QLogUniform]], NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
description: Union[str, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>
) → HPO
Updates an HPO.
method HPO.wait_until_completed
HPO.wait_until_completed
wait_until_completed() → None
Returns the hpo job once it has completed.
class Model
Model
A node that learns its parameters during a training phase, and produces output during a prediction phase.
classmethod Model.create
Model.create
create(
project: Union[ForwardRef('Project'), str, uuid.UUID],
title: str,
connector: myst.connectors.model_connector.ModelConnector,
description: Optional[str] = None
) → Model
Creates a new model node.
Args:
project
: the project in which to create the modeltitle
: the title of the modelconnector
: the model connector to use in the model nodedescription
: a brief description of the model
Returns:
the newly created model
method Model.create_fit_policy
Model.create_fit_policy
create_fit_policy(
schedule_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.CronTiming, myst.models.timing.RelativeTiming],
start_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming],
end_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming],
active: bool = True
) → ModelFitPolicy
method Model.create_input
Model.create_input
create_input(
time_series: Union[myst.resources.time_series.TimeSeries, str, uuid.UUID],
group_name: str,
output_index: int = 0,
label_indexer: Optional[Tuple[Union[int, str, List[Any]], ...], List[Any], int, str] = None
) → ModelInput
Creates a model input into this model.
Args:
time_series
: the time series to feed into this modelgroup_name
: the name of the input group on this model's connector to which to pass the data from this inputoutput_index
: which time dataset, out of the sequence of upstream time datasets, to pass to this modellabel_indexer
: the slice of the upstream data to pass to this model
Returns:
the newly created input
method Model.fit
Model.fit
fit(
start_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming],
end_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming]
) → ModelFitJob
Create an ad hoc model fit job for this model.
classmethod Model.get
Model.get
get(
project: Union[ForwardRef('Project'), str, uuid.UUID],
uuid: Union[str, uuid.UUID]
) → Model
Gets a specific model by its identifier.
method Model.get_fit_result
Model.get_fit_result
get_fit_result(uuid: Union[str, uuid.UUID]) → ModelFitResult
method Model.get_run_result
Model.get_run_result
get_run_result(
model_result: Union[myst.resources.result.ModelRunResultMetadata, str, uuid.UUID]
) → ModelRunResult
classmethod Model.list
Model.list
list(
project: Union[ForwardRef('Project'), str, uuid.UUID]
) → List[ForwardRef('Model')]
Gets all models by project.
method Model.list_fit_policies
Model.list_fit_policies
list_fit_policies() → List[myst.resources.policy.ModelFitPolicy]
method Model.list_fit_results
Model.list_fit_results
list_fit_results() → List[myst.resources.result.ModelFitResult]
method Model.list_inputs
Model.list_inputs
list_inputs() → List[myst.resources.input.ModelInput]
Lists all model inputs into this model.
method Model.list_run_results
Model.list_run_results
list_run_results() → List[myst.resources.result.ModelRunResultMetadata]
method Model.update
Model.update
update(
title: Union[str, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
connector: Union[myst.connectors.model_connector.ModelConnector, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
description: Union[str, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>
) → Model
Updates model.
class ModelFitPolicy
ModelFitPolicy
Describes when and over what natural time range to run a fit job on a model.
classmethod ModelFitPolicy.create
ModelFitPolicy.create
create(
project: Union[ForwardRef('Project'), str, uuid.UUID],
model: Union[ForwardRef('Model'), str, uuid.UUID],
schedule_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.CronTiming, myst.models.timing.RelativeTiming],
start_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming],
end_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming],
active: bool = True
) → ModelFitPolicy
Creates a fit policy for the model.
classmethod ModelFitPolicy.get
ModelFitPolicy.get
get(
project: Union[ForwardRef('Project'), str, uuid.UUID],
model: Union[ForwardRef('Model'), str, uuid.UUID],
uuid: Union[str, uuid.UUID]
) → ModelFitPolicy
Gets a specific fit policy by its identifier.
classmethod ModelFitPolicy.list
ModelFitPolicy.list
list(
project: Union[ForwardRef('Project'), str, uuid.UUID],
model: Union[ForwardRef('Model'), str, uuid.UUID]
) → List[ForwardRef('ModelFitPolicy')]
Lists all fit policies for the model.
method ModelFitPolicy.update
ModelFitPolicy.update
update(
schedule_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.CronTiming, myst.models.timing.RelativeTiming, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
start_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
end_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
active: Union[bool, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>
) → ModelFitPolicy
Updates the fit policy for the model.
class Operation
Operation
A node that performs a specified transformation on its input.
In contrast to a model, an operation has no training phase and can only be run.
classmethod Operation.create
Operation.create
create(
project: Union[ForwardRef('Project'), str, uuid.UUID],
title: str,
connector: myst.connectors.operation_connector.OperationConnector,
description: Optional[str] = None
) → Operation
Creates a new operation node.
Args:
project
: the project in which to create the operationtitle
: the title of the operationconnector
: the operation connector to use in the operation nodedescription
: a brief description of the operation
Returns:
the newly created operation
method Operation.create_input
Operation.create_input
create_input(
time_series: Union[myst.resources.time_series.TimeSeries, str, uuid.UUID],
group_name: str,
output_index: int = 0,
label_indexer: Optional[Tuple[Union[int, str, List[Any]], ...], List[Any], int, str] = None
) → OperationInput
Creates an input into this operation.
Args:
time_series
: the time series to feed into this operationgroup_name
: the name of the input group on this operation's connector to which to pass the data from this inputoutput_index
: which time dataset, out of the sequence of upstream time datasets, to pass to this operationlabel_indexer
: the slice of the upstream data to pass to this operation
Returns:
the newly created input
classmethod Operation.get
Operation.get
get(
project: Union[ForwardRef('Project'), str, uuid.UUID],
uuid: Union[str, uuid.UUID]
) → Operation
Gets a specific operation by its identifier.
classmethod Operation.list
Operation.list
list(
project: Union[ForwardRef('Project'), str, uuid.UUID]
) → List[ForwardRef('Operation')]
Gets all operations by project.
method Operation.list_inputs
Operation.list_inputs
list_inputs() → List[myst.resources.input.OperationInput]
Lists all inputs into this operation.
method Operation.update
Operation.update
update(
title: Union[str, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
connector: Union[myst.connectors.operation_connector.OperationConnector, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
description: Union[str, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>
) → Operation
Updates operation.
class Policy
Policy
Describes when and over what natural time range to run a particular type of job for a node.
Attributes:
project
: the identifier of the project this policy belongs tocreator
: the identifier of the user who created this resourceschedule_timing
: when the policy is scheduled to run, whether recurrent or onceactive
: whether this policy is currently in effectnode
: the identifier of the node this policy applies tostart_timing
: the beginning of the natural time range for which this policy applies, inclusiveend_timing
: the end of the natural time range for which this policy applies, exclusive
class Project
Project
A workspace for creating and deploying graphs of time series.
A project collects the nodes and edges of the graph along with any policies used to execute the graph.
classmethod Project.create
Project.create
create(
title: str,
description: Optional[str] = None,
organization_sharing_enabled: bool = False,
organization_sharing_role: Optional[myst.models.enums.OrgSharingRole] = None
) → Project
Creates a new project.
Args:
title
: the title of the projectdescription
: a brief description of the projectorganization_sharing_enabled
: whether the project should be shared with the organizationorganization_sharing_role
: the level of sharing access to this project to give users in the organization
Returns:
the newly created project
method Project.create_model
Project.create_model
create_model(
title: str,
connector: myst.connectors.model_connector.ModelConnector,
description: Optional[str] = None
) → Model
Creates a new model node in this project.
Args:
title
: the title of the modelconnector
: specification of the connector this model should usedescription
: a brief description of the model
Returns:
the newly created model
method Project.create_operation
Project.create_operation
create_operation(
title: str,
connector: myst.connectors.operation_connector.OperationConnector,
description: Optional[str] = None
) → Operation
Creates a new operation node in this project.
Args:
title
: the title of the operationconnector
: specification of the connector this operation should usedescription
: a brief description of the operation
Returns:
the newly created operation
method Project.create_source
Project.create_source
create_source(
title: str,
connector: myst.connectors.source_connector.SourceConnector,
description: Optional[str] = None
) → Source
Creates a new source node in this project.
Args:
title
: the title of the sourceconnector
: specification of the connector this source should usedescription
: a brief description of the source
Returns:
the newly created source
method Project.create_time_series
Project.create_time_series
create_time_series(
title: str,
sample_period: myst.core.time.time_delta.TimeDelta,
cell_shape: Tuple[int, ...] = (),
coordinate_labels: Tuple[Tuple[Union[int, str], ...], ...] = (),
axis_labels: Tuple[Union[int, str], ...] = (),
description: Optional[str] = None
) → TimeSeries
Creates a new time series node in this project.
Args:
title
: the title of the time seriessample_period
: the frequency at which the data is sampledcell_shape
: the shape of the data in each cell of the time seriescoordinate_labels
: the labels for each coordinate of a cell in the time seriesaxis_labels
: the labels for each axis of a cell in the time seriesdescription
: a brief description of the time series
Returns:
the newly created time series
method Project.create_time_series_from_recipe
Project.create_time_series_from_recipe
create_time_series_from_recipe(
recipe: 'TimeSeriesRecipe',
title: Optional[str] = None,
description: Optional[str] = None
) → TimeSeries
Creates a new time series node in this project based on a provided recipe.
Args:
recipe
: the recipe used to create the time seriestitle
: the title of the time series; if none is given, the recipe will supply a sensible defaultdescription
: the description of the time series
Returns:
the newly created time series
method Project.delete
Project.delete
delete(requires_confirmation: bool = True) → Project
Deletes the project.
Args:
requires_confirmation
: whether or not the user is required to confirm the project title
Raises:
ValueError
: if confirmation input title is not matched
Returns:
project that has been deleted
method Project.deploy
Project.deploy
deploy(title: str) → Deployment
Deploys the current project.
Args:
title
: the title for the deployment
Returns:
the newly created deployment
classmethod Project.filter
Project.filter
filter(title: str) → List[ForwardRef('Project')]
Filters all projects visible to the user by title.
Args:
title
: the title of the project to filter
Returns:
list of projects that have the specified title
classmethod Project.get
Project.get
get(uuid: Union[str, uuid.UUID]) → Project
Gets a specific project by its identifier.
classmethod Project.list
Project.list
list() → List[ForwardRef('Project')]
Lists all projects visible to the user.
method Project.list_edges
Project.list_edges
list_edges() → List[myst.resources.edge.Edge]
Lists all edges in this project.
method Project.list_nodes
Project.list_nodes
list_nodes() → List[myst.resources.node.Node]
Lists all nodes in this project.
method Project.update
Project.update
update(
title: Union[str, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
description: Union[str, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
organization_sharing_enabled: Union[bool, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
organization_sharing_role: Union[myst.models.enums.OrgSharingRole, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>
) → Project
Updates the project.
Could not generate markdown for object type <class 'myst.settings.Settings'>
class Source
Source
A node which produces data without any inputs.
classmethod Source.create
Source.create
create(
project: Union[ForwardRef('Project'), str, uuid.UUID],
title: str,
connector: myst.connectors.source_connector.SourceConnector,
description: Optional[str] = None
) → Source
Creates a new source node.
Args:
project
: the project in which to create the sourcetitle
: the title of the sourceconnector
: the source connector to use in the source nodedescription
: a brief description of the source
Returns:
the newly created source
classmethod Source.get
Source.get
get(
project: Union[ForwardRef('Project'), str, uuid.UUID],
uuid: Union[str, uuid.UUID]
) → Source
Gets a specific source by its identifier.
classmethod Source.list
Source.list
list(
project: Union[ForwardRef('Project'), str, uuid.UUID]
) → List[ForwardRef('Source')]
Gets all sources by project.
method Source.update
Source.update
update(
title: Union[str, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
connector: Union[myst.connectors.source_connector.SourceConnector, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
description: Union[str, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>
) → Source
Updates source.
class Time
Time
Container for time zone-aware time objects that can be mapped from and to various third-party time objects.
method Time.**init**
Time.**init**
__init__(value: Union[ForwardRef('Time'), datetime.datetime, str]) → None
A Time
container is initialized with a datetime or an ISO 8601 formatted string.
The full ISO 8601 format specification is YYYY-MM-DDThh:mm:ssZ
. The Z
suffix indicates the UTC time zone.
Note that we only support ISO strings that are in UTC, to avoid possible ambiguity around daylight savings.
Args:
value
: ISO 8601 formatted string in UTC, or time zone-aware datetime
method Time.to_datetime
Time.to_datetime
to_datetime() → datetime
Returns the datetime.datetime
equivalent of this time.
method Time.to_iso_string
Time.to_iso_string
to_iso_string() → str
Returns the ISO 8601 formatted string representation of this time.
method Time.to_pandas_timestamp
Time.to_pandas_timestamp
to_pandas_timestamp() → Timestamp
Returns the pandas.Timestamp
equivalent of this time.
classmethod Time.validate
Time.validate
validate(v: Any) → Time
class TimeArray
TimeArray
property TimeArray.cell_shape
The shape of the data in this time array at a single timestamp.
property TimeArray.empty
Returns True if this time array is empty, False otherwise.
property TimeArray.shape
The shape of this time array, where the time axis is included as the first dimension.
classmethod TimeArray.check_axis_labels
TimeArray.check_axis_labels
check_axis_labels(
axis_labels: Tuple[Union[int, str], ...],
values: Dict[str, Any]
) → Tuple[Union[int, str], ...]
Checks that the axis labels are unique and compatible with cell shape of values.
classmethod TimeArray.check_coordinate_labels
TimeArray.check_coordinate_labels
check_coordinate_labels(
coordinate_labels: Tuple[Tuple[Union[int, str], ...], ...],
values: Dict[str, Any]
) → Tuple[Tuple[Union[int, str], ...], ...]
Checks that the coordinate labels are unique in each axis and compatible with cell shape of values.
classmethod TimeArray.check_length_of_data_against_index
TimeArray.check_length_of_data_against_index
check_length_of_data_against_index(values: Dict[str, Any]) → Dict[str, Any]
classmethod TimeArray.check_time_range_parameters
TimeArray.check_time_range_parameters
check_time_range_parameters(values: Dict[str, Any]) → Dict[str, Any]
classmethod TimeArray.fill_in_axis_labels_if_none
TimeArray.fill_in_axis_labels_if_none
fill_in_axis_labels_if_none(axis_labels: Any, values: Dict[str, Any]) → Any
Returns axis labels unchanged if not None, otherwise default integer-valued coordinate labels.
classmethod TimeArray.fill_in_coordinate_labels_if_none
TimeArray.fill_in_coordinate_labels_if_none
fill_in_coordinate_labels_if_none(
coordinate_labels: Any,
values: Dict[str, Any]
) → Any
Returns coordinate labels unchanged if not None, otherwise default integer-valued coordinate labels.
classmethod TimeArray.from_numpy_masked_array
TimeArray.from_numpy_masked_array
from_numpy_masked_array(
numpy_masked_array: numpy.ma.core.MaskedArray,
sample_period: myst.core.time.time_delta.TimeDelta,
start_time: myst.core.time.time.Time,
end_time: myst.core.time.time.Time,
as_of_time: myst.core.time.time.Time,
coordinate_labels: Optional[Tuple[Tuple[Union[int, str], ...], ...]] = None,
axis_labels: Optional[Tuple[Union[int, str], ...]] = None
) → TimeArray
Constructs a time array from a numpy.ma.MaskedArray
instance.
Args:
numpy_masked_array
: numpy masked arraysample_period
: sample periodstart_time
: start timeend_time
: end timeas_of_time
: as of timecoordinate_labels
: labels for individual coordinatesaxis_labels
: names for individual axes
Returns:
time array
classmethod TimeArray.from_pandas_data_frame
TimeArray.from_pandas_data_frame
from_pandas_data_frame(
pandas_data_frame: pandas.core.frame.DataFrame,
as_of_time: myst.core.time.time.Time,
mask: Optional[numpy.ndarray] = None
) → TimeArray
Constructs a time array from a pandas.DataFrame
instance.
In order to use this constructor, the pandas.DataFrame
instance must be indexed by a pandas.DatetimeIndex
with a specified frequency which is used to define the sample_period
of the TimeArray
.
Additionally, the columns
must be instantiated with a named pandas.Index
, which is used to define the axis_labels
and coordinate_labels
of the TimeArray
.
Args:
pandas_data_frame
: pandas data frameas_of_time
: as of timemask
: binary array with mask
Returns:
time array
Raises:
ValueError
: if data frame does not represent a valid time array
classmethod TimeArray.from_pandas_object
TimeArray.from_pandas_object
from_pandas_object(
pandas_object: Union[pandas.core.series.Series, pandas.core.frame.DataFrame],
as_of_time: myst.core.time.time.Time,
mask: Optional[numpy.ndarray] = None
) → TimeArray
Constructs a time array from a pandas.Series
or pandas.DataFrame
instance.
In order to use this constructor, the pandas object must be indexed by a pandas.DatetimeIndex
with a specified frequency which is used to define the sample_period
of the TimeArray
.
Additionally, if the object is a series, it must be named with an integer or string, which is used to define the coordinate_labels
of the TimeArray
. If the object is a data frame, the columns
must be instantiated with a named pandas.Index
, which is used to define the axis_labels
and coordinate_labels
of the TimeArray
.
Args:
pandas_object
: a pandas series or data frameas_of_time
: as of timemask
: binary array with mask
Returns:
time array
Raises:
ValueError
: if object is neither apandas.Series
orpandas.DataFrame
classmethod TimeArray.from_pandas_series
TimeArray.from_pandas_series
from_pandas_series(
pandas_series: pandas.core.series.Series,
as_of_time: myst.core.time.time.Time,
mask: Optional[numpy.ndarray] = None
) → TimeArray
Constructs a time array from a pandas.Series
instance.
In order to use this constructor, the pandas.Series
instance must be indexed by a pandas.DatetimeIndex
with a specified frequency which is used to define the sample_period
of the TimeArray
.
Additionally, the series must be named with an integer or string, which is used to define the coordinate_labels
of the TimeArray
.
Args:
pandas_series
: pandas seriesas_of_time
: as of timemask
: binary array with mask
Returns:
time array
method TimeArray.to_numpy_masked_array
TimeArray.to_numpy_masked_array
to_numpy_masked_array() → MaskedArray
Returns the numpy.ma.MaskedArray
equivalent of this time array.
method TimeArray.to_pandas_data_frame
TimeArray.to_pandas_data_frame
to_pandas_data_frame(apply_mask: Optional[bool] = True) → DataFrame
Returns the pandas.DataFrame
equivalent of the values in this time array.
Note that the mask
of this time array will need to be extracted separately, as this method does not preserve the mask data.
Args:
apply_mask
: whether or not to apply the internalmask
before creating the data frame
Returns:
data frame
Raises:
ValueError
: if the cells are dimensionless
method TimeArray.to_pandas_object
TimeArray.to_pandas_object
to_pandas_object(
apply_mask: Optional[bool] = True
) → Union[pandas.core.series.Series, pandas.core.frame.DataFrame]
The pandas.Series
or pandas.DataFrame
equivalent of the values
in this time array.
Note that the mask
of this time array will need to be extracted separately.
Args:
apply_mask
: whether or not to apply the internalmask
before creating the pandas object
Returns:
pandas object (series or dataframe)
method TimeArray.to_pandas_series
TimeArray.to_pandas_series
to_pandas_series(apply_mask: Optional[bool] = True) → Series
The pandas.Series
equivalent of the values
in this time array.
Note that the mask
of this time array will need to be extracted separately, as this method does not preserve the mask data.
Args:
apply_mask
: whether or not to apply the internalmask
before creating the series
Returns:
pandas series
Raises:
ValueError
: if the cells are not dimensionless
class TimeDelta
TimeDelta
Container for time delta objects that can be mapped from and to various third-party time objects.
Note that TimeDelta
respects calendar arithmetic for days, weeks, months, and years. This may cause mappings to some third-party time delta objects to fail, if they don't support this paradigm (e.g. datetime.timedelta
).
method TimeDelta.**init**
TimeDelta.**init**
__init__(
value: Union[ForwardRef('TimeDelta'), pandas._libs.tslibs.offsets.DateOffset, pandas._libs.tslibs.offsets.Day, pandas._libs.tslibs.offsets.Hour, pandas._libs.tslibs.offsets.Minute, pandas._libs.tslibs.offsets.Second, datetime.timedelta, str]
) → None
A TimeDelta
container is initialized with a date offset, time delta, or ISO 8601 formatted string.
The full ISO 8601 format specification is PnYnMnDTnHnMnS
.
Note that we only support integer values for all n
and thus do not have support for sub-second precision.
Args:
value
: date offset, time delta, or ISO 8601 formatted string
method TimeDelta.to_datetime_timedelta
TimeDelta.to_datetime_timedelta
to_datetime_timedelta() → timedelta
Returns the datetime.timedelta
equivalent of this time delta.
method TimeDelta.to_iso_string
TimeDelta.to_iso_string
to_iso_string() → str
Returns the ISO 8601 formatted string representation of this time.
method TimeDelta.to_pandas_date_offset
TimeDelta.to_pandas_date_offset
to_pandas_date_offset() → DateOffset
Returns the pandas.DateOffset
equivalent of this time delta.
method TimeDelta.to_pandas_frequency
TimeDelta.to_pandas_frequency
to_pandas_frequency() → DateOffset
Returns the pandas frequency equivalent of this time delta.
method TimeDelta.to_pandas_timedelta
TimeDelta.to_pandas_timedelta
to_pandas_timedelta() → Timedelta
Returns the pandas.Timedelta
equivalent of this time delta.
classmethod TimeDelta.validate
TimeDelta.validate
validate(v: Any) → TimeDelta
class TimeSeries
TimeSeries
A queryable, shareable node containing fixed-frequency, arbitrarily dimensioned time series data.
A time series stitches together data from multiple layers into a single stream, by consuming data from lower- precedence layers when data from higher-precedence layers is not available, and by consuming only the upstream data that is within the time range bounds set on each layer.
In addition to queries, a time series also supports inserts, which take precedence over data flowing through the input layers.
Attributes:
sample_period
: the frequency at which the data is sampledcell_shape
: the shape of the data in each cellcoordinate_labels
: the labels for each coordinate of a cellaxis_labels
: the labels for each axis of a cell
classmethod TimeSeries.create
TimeSeries.create
create(
project: Union[ForwardRef('Project'), str, uuid.UUID],
title: str,
sample_period: myst.core.time.time_delta.TimeDelta,
cell_shape: Tuple[int, ...] = (),
coordinate_labels: Tuple[Tuple[Union[int, str], ...], ...] = (),
axis_labels: Tuple[Union[int, str], ...] = (),
description: Optional[str] = None
) → TimeSeries
Creates a new time series node.
Args:
project
: the project in which to create the time seriestitle
: the title of the time seriessample_period
: the frequency at which the data is sampledcell_shape
: the shape of the data in each cell of the time seriescoordinate_labels
: the labels for each coordinate of a cell in the time seriesaxis_labels
: the labels for each axis of a cell in the time seriesdescription
: a brief description of the time series
Returns:
the newly created time series
classmethod TimeSeries.create_from_recipe
TimeSeries.create_from_recipe
create_from_recipe(
project: Union[ForwardRef('Project'), str, uuid.UUID],
recipe: 'TimeSeriesRecipe',
title: Optional[str] = None,
description: Optional[str] = None
) → TimeSeries
Creates a new time series node based on a provided recipe.
Args:
project
: the project in which to create the time seriesrecipe
: the recipe used to create the time seriestitle
: the title of the time series; if none is given, the recipe will supply a sensible defaultdescription
: the description of the time series
Returns:
the newly created time series
method TimeSeries.create_layer
TimeSeries.create_layer
create_layer(
node: Union[myst.resources.node.Node, str, uuid.UUID],
order: int,
output_index: int = 0,
label_indexer: Optional[Tuple[Union[int, str, List[Any]], ...], List[Any], int, str] = None,
start_timing: Optional[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming] = None,
end_timing: Optional[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming] = None
) → TimeSeriesLayer
Creates a layer into this time series.
Args:
node
: the node whose data will flow into this time seriesorder
: integer specifying priority of this layer when combining multiple layers; lower order implies higher precedenceoutput_index
: which time dataset, out of the sequence of upstream time datasets, to pass to this time serieslabel_indexer
: the slice of the upstream data to pass to this time seriesstart_timing
: the beginning of the natural time range this layer should produce data for; if None, there is no restriction on the beginning of the rangeend_timing
: the end of the natural time range this layer should produce data for; if None, there is no restriction on the end of the range
Returns:
the newly created time series layer
method TimeSeries.create_run_policy
TimeSeries.create_run_policy
create_run_policy(
schedule_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.CronTiming, myst.models.timing.RelativeTiming],
start_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming],
end_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming],
active: bool = True
) → TimeSeriesRunPolicy
classmethod TimeSeries.get
TimeSeries.get
get(
project: Union[ForwardRef('Project'), str, uuid.UUID],
uuid: Union[str, uuid.UUID]
) → TimeSeries
Gets a specific time series by its identifier.
method TimeSeries.get_run_result
TimeSeries.get_run_result
get_run_result(uuid: Union[str, uuid.UUID]) → TimeSeriesRunResult
method TimeSeries.insert_time_array
TimeSeries.insert_time_array
insert_time_array(time_array: myst.core.data.time_array.TimeArray) → None
Inserts data from a TimeArray
into this time series.
The data from this manual insertion will take precedence over the other layers flowing into this time series.
Args:
time_array
: the array of data to be inserted
classmethod TimeSeries.list
TimeSeries.list
list(
project: Union[ForwardRef('Project'), str, uuid.UUID]
) → List[ForwardRef('TimeSeries')]
Gets all time series by project.
method TimeSeries.list_layers
TimeSeries.list_layers
list_layers() → List[myst.resources.layer.TimeSeriesLayer]
Lists all layers into this time series.
method TimeSeries.list_run_policies
TimeSeries.list_run_policies
list_run_policies() → List[myst.resources.policy.TimeSeriesRunPolicy]
method TimeSeries.list_run_results
TimeSeries.list_run_results
list_run_results() → List[myst.resources.result.TimeSeriesRunResultMetadata]
method TimeSeries.query_time_array
TimeSeries.query_time_array
query_time_array(
start_time: myst.core.time.time.Time,
end_time: myst.core.time.time.Time,
as_of_time: Optional[myst.core.time.time.Time] = None,
as_of_offset: Optional[myst.core.time.time_delta.TimeDelta] = None
) → TimeArray
Queries this time series for data according to the given parameters.
At most one of as_of_time
and as_of_offset
may be specified. If as_of_time
is specified, the query will return data as of that particular time. If as_of_offset
is specified, the query will return data for a constant offset between the "natural" time and the as of time. If neither is specified, the API assumes an as_of_time
of now.
Args:
start_time
: the beginning of the natural time range to query over, inclusiveend_time
: the end of the natural time range to query over, exclusiveas_of_time
: the precise as of time to queryas_of_offset
: the offset from as of time to query by, where as_of_offset = natural_time - as_of_time
Returns:
a time array containing data for the specified time range and as of time
Raises:
ValueError
: if bothas_of_time
andas_of_offset
are specified
method TimeSeries.run
TimeSeries.run
run(
start_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming],
end_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming]
) → TimeSeriesRunJob
Create an ad hoc node run job for this time series.
method TimeSeries.update
TimeSeries.update
update(
title: Union[str, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
sample_period: Union[myst.core.time.time_delta.TimeDelta, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
cell_shape: Union[Tuple[int, ...], NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
coordinate_labels: Union[Tuple[Tuple[Union[int, str], ...], ...], NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
axis_labels: Union[Tuple[Union[int, str], ...], NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
description: Union[str, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>
) → TimeSeries
Updates time series.
class TimeSeriesRunPolicy
TimeSeriesRunPolicy
Describes when and over what natural time range to run a fit job on a model.
classmethod TimeSeriesRunPolicy.create
TimeSeriesRunPolicy.create
create(
project: Union[ForwardRef('Project'), str, uuid.UUID],
time_series: Union[ForwardRef('TimeSeries'), str, uuid.UUID],
schedule_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.CronTiming, myst.models.timing.RelativeTiming],
start_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming],
end_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming],
active: bool = True
) → TimeSeriesRunPolicy
Creates a run policy for the time series.
classmethod TimeSeriesRunPolicy.get
TimeSeriesRunPolicy.get
get(
project: Union[ForwardRef('Project'), str, uuid.UUID],
time_series: Union[ForwardRef('TimeSeries'), str, uuid.UUID],
uuid: Union[str, uuid.UUID]
) → TimeSeriesRunPolicy
Gets a specific run policy by its identifier.
classmethod TimeSeriesRunPolicy.list
TimeSeriesRunPolicy.list
list(
project: Union[ForwardRef('Project'), str, uuid.UUID],
time_series: Union[ForwardRef('TimeSeries'), str, uuid.UUID]
) → List[ForwardRef('TimeSeriesRunPolicy')]
Lists all run policies for the time series.
method TimeSeriesRunPolicy.update
TimeSeriesRunPolicy.update
update(
schedule_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.CronTiming, myst.models.timing.RelativeTiming, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
start_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
end_timing: Union[myst.core.time.time.Time, myst.core.time.time_delta.TimeDelta, myst.models.timing.AbsoluteTiming, myst.models.timing.RelativeTiming, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>,
active: Union[bool, NoneType, myst.models.types.Unset] = <myst.models.types.Unset object at 0x133651160>
) → TimeSeriesRunPolicy
Updates the run policy for the time series.
Updated about 2 years ago