mstrio.server package

Submodules

mstrio.server.cluster module

class mstrio.server.cluster.Cluster(connection: mstrio.connection.Connection)

Bases: object

Manage, list nodes (servers) on a cluster.

Manage Services on nodes. Manage node settings. Load and Unload projects. A “service” is a product developed by MicroStrategy or a third-party product distributed by MicroStrategy i.e. “MicroStrategy Intelligence Server” or “Apache ZooKeeper”.

add_node(node: Union[str, mstrio.server.node.Node]) None

Add server (node) to the cluster.

Parameters

node – name or object of node to be added

check_dependency(service: str) List[str]

Check all dependencies for the given service.

Raises

ValueError – If incorrect service name is provided.

list_node_settings(node: Union[str, mstrio.server.node.Node]) Dict

List server (nodes) settings.

Parameters

node – name or object of node which settings will be listed

Returns

dictionary with the settings of node returned from I-Server.

list_nodes(project: Optional[Union[str, Project]] = None, node: Optional[Union[str, mstrio.server.node.Node]] = None, to_dictionary: bool = False) Union[List[mstrio.server.node.Node], List[dict]]

Return a list of nodes and their properties within the cluster.

Optionally filter by project_id or node_name.

Parameters
  • project – Project ID or object

  • node – Node name or object

list_projects(to_dictionary: bool = False, limit: Optional[int] = None, **filters) List[Project]

Return list of project objects or if to_dictionary=True project dicts. Optionally filter the Projects by specifying the filters keyword arguments.

Parameters
  • to_dictionary – If True returns list of project dicts

  • limit – limit the number of elements returned. If None, all objects are returned.

  • **filters – Available filter parameters: [‘name’, ‘id’, ‘description’, ‘date_created’, ‘date_modified’, ‘owner’]

list_services(group_by: Union[mstrio.server.cluster.GroupBy, str] = GroupBy.NODES) List

List services in the cluster grouped by nodes or services.

When group_by is set to nodes then in the list for each node there is given a list of services which are available within. When group_by is set to services then in the list for each services there is given a list of nodes on which current service is available.

Parameters

group_by – determine by what the list will be grouped. Either nodes or services.

Returns

list of nodes with services in case of group_by set to nodes or list of services with nodes in case of group_by set to services.

Raises

ValueError if group_by is neither equal to nodes nor services.

load_project(project: Union[str, Project], on_nodes: Optional[Union[str, List[str]]] = None) None

Request to load the project onto the chosen cluster nodes. If nodes are not specified, the project will be loaded on all nodes.

Parameters
  • project – name or object of project which will be loaded

  • on_nodes – name of node or nodes, if not passed, project will be loaded on all of the nodes

nodes_topology(styled=False) Union[pandas.core.frame.DataFrame, Styler]

Return cluster node topology as Pandas DataFrame or Styler object.

DataFrame columns:
  • displayName -> it shows the name with which service is displayed

    in Workstation

  • id -> name of the service within nodes

  • for each node in the cluster there is given a column which name is

    name of a node and its content is information with the status of the given service in this node. Available values of status are: ‘Running’ (green color), ‘Stopped’ (red color), ‘Not Available (service unavailable on the node)

Returns

Pandas DataFrame or Styler object if styled is True.

remove_node(node: Union[str, mstrio.server.node.Node]) None

Remove server (node) from the cluster.

Parameters

node – name or object of node to be removed

reset_node_settings(node: Union[str, mstrio.server.node.Node]) None

Remove I-Server configuration settings for given node within a cluster. Default values will be applied after execution of this method.

Parameters

node – name of the node for which default settings will be applied.

services_topology(styled=False) Union[pandas.core.frame.DataFrame, Styler]

Return cluster service topology as Pandas DataFrame or Styler object.

DataFrame columns:
  • service -> name of the service

  • node -> name on which service appears (each service can appear in

    more than one service and then name of the service is provided only once for the group of nodes in which it appears)

  • status -> status which a given service has on a given node.

    Available values of statuses are: ‘Running’ (green color), ‘Stopped’ (red color), ‘Not Available (service unavailable on the node)

Returns

Pandas DataFrame or Styler object if styled is True.

set_primary_node(node: Union[str, mstrio.server.node.Node]) None

Set default/primary server (node) for the cluster.

Parameters

name – name or object of the node which will be set as default for this cluster

start(service: str, nodes: List[str], login: Optional[str] = None, passwd: Optional[str] = None)

Start up a service on selected nodes.

Parameters
  • service – name of the service which will be started

  • nodes – list of names of nodes on which service will be started

  • login – login for SSH operation. If not provided, the user will be prompted.

  • passwd – password for SSH operation. If not provided, the user will be prompted.

Raises

ValueError – If incorrect node/service name is provided

stop(service: str, nodes: List[str], login: Optional[str] = None, passwd: Optional[str] = None, force: bool = False)

Stop a service on selected nodes. Provided service and node names are checked for correctness.

Parameters
  • service – name of the service which will be started

  • nodes – list of names of nodes on which service will be started

  • login – login for SSH operation. If not provided, the user will be prompted.

  • passwd – password for SSH operation. If not provided, the user will be prompted.

  • force – if True, no additional prompt will be shown before

Raises

ValueError – If incorrect node/service name is provided

unload_project(project: Union[str, Project], on_nodes: Optional[Union[str, List[str]]] = None) None

Request to unload the project from the chosen cluster nodes. If nodes are not specified, the project will be unloaded on all nodes. The unload action cannot be performed until all jobs and connections for project are completed. Once these processes have finished, pending project will be automatically unloaded.

Parameters
  • project – name or object of project which will be unloaded

  • on_nodes – name of node or nodes, if not passed, project will be unloaded on all of the nodes

update_node_settings(node: Union[str, mstrio.server.node.Node], load_balance_factor: int, initial_pool_size: int, max_pool_size: int) None

Update I-Server configuration settings for a given server node within a cluster.

Parameters
  • load_balance_factor – This setting becomes relevant in an environment that has a MicroStrategy Intelligence Server cluster. By default, the load balance factor is 1. The value can be increased on more powerful servers in a cluster to provide an appropriate balance. A larger load balance factor means the current server consumes a greater load in the server cluster in which it resides.

  • initial_pool_size – Initial number of connections available.

  • max_pool_size – Maximum number of connections available.

class mstrio.server.cluster.GroupBy(value)

Bases: str, mstrio.utils.enum_helper.AutoName

An enumeration.

NODES = 'nodes'
SERVICES = 'services'
class mstrio.server.cluster.ServiceAction(value)

Bases: str, mstrio.utils.enum_helper.AutoUpperName

An enumeration.

START = 'START'
STOP = 'STOP'

mstrio.server.environment module

class mstrio.server.environment.Environment(connection)

Bases: object

Browse and manage Projects on the environment. List loaded projects, nodes (servers) and compare project settings on the environment. Browse and modify I-Server settings.

connection

A MicroStrategy connection object.

server_settings

Intelligence Server settings object.

compare_settings(projects: Optional[Union[List[str], List[mstrio.server.project.Project]]] = None, show_diff_only: bool = False) pandas.core.frame.DataFrame

Compare project’ settings to the first project in the provided list.

Parameters
  • projects (list of names or project objects, optional) – List of project objects or names to be compared. First element of list is the one to which the rest is compared. If None, all projects on the environment will be compared.

  • show_diff_only (bool, optional) – Whether to display all settings or only different from first project in list.

Returns

Dataframe with values of selected project’ settings.

create_project(name: str, description: Optional[str] = None, force: bool = False) Optional[mstrio.server.project.Project]

Create a new project on the environment.

Parameters
  • name – Name of Project.

  • description – Description of Application.

  • force – If True, overrides the prompt.

fetch_settings() None

Fetch the current server settings from the environment.

is_loaded(project_id: Optional[str] = None, project_name: Optional[str] = None) bool

Check if project is loaded, by passing project ID or name, returns True or False.

Parameters
  • project_id – Project ID

  • project_name – Project name

list_loaded_projects(to_dictionary: bool = False, **filters) Union[List[mstrio.server.project.Project], List[dict]]

Return list of all loaded project objects or project dicts if to_dictionary=True that the user has access to. Optionally filter the Projects by specifying the filters keyword arguments.

Parameters
  • to_dictionary – If True, returns list of project dicts

  • **filters – Available filter parameters: [‘acg’, ‘id’, ‘name’, ‘status’, ‘alias’, ‘description’, ‘date_created’, ‘date_modified’, ‘owner’]

list_nodes(project: Optional[Union[mstrio.server.project.Project, str]] = None, node_name: Optional[str] = None) List[dict]

Return a list of I-Server nodes and their properties. Optionally filter by project or node_name.

Parameters
  • project – ID of project or Project object

  • node_name – Name of node

list_projects(to_dictionary: bool = False, limit: Optional[int] = None, **filters) Union[List[mstrio.server.project.Project], List[dict]]

Return list of project objects or project dicts if to_dictionary=True. Optionally filter the Projects by specifying the filters keyword arguments.

Parameters
  • to_dictionary – If True returns list of project dicts.

  • limit – limit the number of elements returned. If None, all objects are returned.

  • **filters – Available filter parameters: [‘name’, ‘id’, ‘description’, ‘date_created’, ‘date_modified’, ‘owner’].

update_settings()

Update the current server settings saved in the ServerSettings object.

mstrio.server.job_monitor module

class mstrio.server.job_monitor.DeliveryType(value)

Bases: mstrio.utils.enum_helper.AutoName

An enumeration.

ALL_INCLUDING_SNAPSHOT = 'all_including_snapshot'
ANDROID = 'android'
BLACKBERRY = 'blackberry'
CACHE = 'cache'
CAMPAIGN = 'campaign'
CLIENT = 'client'
COUNT = 'count'
CUSTOM = 'custom'
EMAIL = 'email'
FILE = 'file'
FTP = 'ftp'
INBOX = 'inbox'
IPAD = 'ipad'
IPHONE = 'iphone'
LAST_ONE = 'last_one'
MOBILE = 'mobile'
PRINTER = 'printer'
RESERVED = 'reserved'
SNAPSHOT = 'snapshot'
class mstrio.server.job_monitor.Job(connection: mstrio.connection.Connection, id: str)

Bases: mstrio.utils.entity.EntityBase

Python representation of a Job object. Note: Some functionality is missing when working with 11.3.2 I-Server

versions. To use all functionality 11.3.3 and up will be required. There are also some differences between 11.3.2 and 11.3.3+ Job attributes values.

connection

A MicroStrategy connection object

id

Job information id

description

Description of the job

status

Status of the job

type

Type of the job

object_id

Id of object

object_type

Type of object

parent_id

Parent ID

childs_ids

Array of children IDs

subscription_recipient

Subscription recipient of the job

subscription_type

Subscription delivery type of the job

processing_unit_priority

Job Processing Unit Priority

step_id

Step ID of the job

user

Full name of the job initiator

project_name

Name of the project in which the job is active

project_id

Id of the project in which the job is active

pu_name

Processing Unit name

creation_time

Creation time of the job

elapsed_time

Time elapsed since the creation of the job in milliseconds (11.3.3+) or seconds (11.3.2)

step_elapsed_time

Time elapsed since the creation of the step in milliseconds

memory_usage

Memory usage of the job in bytes

client_machine

Client machine running the job

total_tasks

Total tasks of the job

completed_tasks

Completed tasks of the job

error_message

Error message for the job

error_time

Error time of the job

filter_name

Name of the filter for the job

sql

SQL of the job

subscription_owner

Subscription owner

template_name

Name of the template for the job

step_statistics

Step statistics for the job

kill() bool

Kill the job.

Returns

True if successfully killed job, False otherwise.

list_properties() dict

List Job object properties.

class mstrio.server.job_monitor.JobStatus(value)

Bases: mstrio.utils.enum_helper.AutoName

An enumeration.

CACHE_READY = 'cache_ready'
CANCELING = 'canceling'
COMPLETED = 'completed'
DELIVERING = 'delivering'
ERROR = 'error'
EXECUTING = 'executing'
EXPORTING = 'exporting'
LOADING_PROMPT = 'loading_prompt'
READY = 'ready'
RESOLVING_DESTINATION = 'resolving_destination'
STEP_PAUSING = 'step_pausing'
STOPPED = 'stopped'
WAITING = 'waiting'
WAITING_FOR_AUTOPROMPT = 'waiting_for_autoprompt'
WAITING_FOR_CACHE = 'waiting_for_cache'
WAITING_FOR_CHILDREN = 'waiting_for_children'
WAITING_FOR_CONFLICT_RESOLVE = 'waiting_for_conflict_resolve'
WAITING_FOR_DI_FILE = 'waiting_for_di_file'
WAITING_FOR_PROJECT = 'waiting_for_project'
WAITING_FOR_RESULTS = 'waiting_for_results'
WAITING_ON_GOVERNOR = 'waiting_on_governor'
class mstrio.server.job_monitor.JobType(value)

Bases: mstrio.utils.enum_helper.AutoName

An enumeration.

INTERACTIVE = 'interactive'
PREDICTIVE_CACHE = 'predictive_cache'
SUBSCRIPTION = 'subscription'
class mstrio.server.job_monitor.ObjectType(value)

Bases: mstrio.utils.enum_helper.AutoName

An enumeration.

CUBE = 'cube'
DOCUMENT = 'document'
DOSSIER = 'dossier'
OTHERS = 'others'
REPORT = 'report'
class mstrio.server.job_monitor.PUName(value)

Bases: mstrio.utils.enum_helper.AutoName

An enumeration.

ANALYTICAL = 'analytical'
BROWSING = 'browsing'
DATA_FORMATTING = 'data_formatting'
NCS = 'ncs'
QUERY_EXECUTIONS = 'query_execution'
RESOLUTION = 'resolution'
REST_ASYNCHRONOUS = 'rest_asynchronous'
SQL_ENGINE = 'sql_engine'
class mstrio.server.job_monitor.SortBy(value)

Bases: enum.Enum

An enumeration.

COMPLETED_TASKS_ASC = '+completedTasks'
COMPLETED_TASKS_DESC = '-completedTasks'
CREATION_TIME_ASC = '+creationTime'
CREATION_TIME_DESC = '-creationTime'
DESCRIPTION_ASC = '+description'
DESCRIPTION_DESC = '-description'
ELAPSED_TIME_ASC = '+elapsedTime'
ELAPSED_TIME_DESC = '-elapsedTime'
ID_ASC = '+id'
ID_DESC = '-id'
MEMORY_USAGE_ASC = '+memoryUsage'
MEMORY_USAGE_DESC = '-memoryUsage'
OBJECT_ID_ASC = '+objectId'
OBJECT_ID_DESC = '-objectId'
OBJECT_TYPE_ASC = '+objectType'
OBJECT_TYPE_DESC = '-objectType'
PROCESSING_UNIT_PRIORITY_ASC = '+processingUnitPriority'
PROCESSING_UNIT_PRIORITY_DESC = '-processingUnitPriority'
PROJECT_ID_ASC = '+projectId'
PROJECT_ID_DESC = '-projectId'
PROJECT_NAME_ASC = '+projectName'
PROJECT_NAME_DESC = '-projectName'
STATUS_ASC = '+status'
STATUS_DESC = '-status'
SUBSCRIPTION_RECIPIENT_ASC = '+subscriptionRecipient'
SUBSCRIPTION_RECIPIENT_DESC = '-subscriptionRecipient'
SUBSCRIPTION_TYPE_ASC = '+subscriptionType'
SUBSCRIPTION_TYPE_DESC = '-subscriptionType'
TYPE_ASC = '+type'
TYPE_DESC = '-type'
USER_ASC = '+user'
USER_DESC = '-user'
class mstrio.server.job_monitor.SortByV1(value)

Bases: enum.Enum

An enumeration.

CREATION_TIME = 'creationTime'
DESCRIPTION = 'description'
JOB_ID = 'jobId'
JOB_TYPE = 'jobType'
OBJECT_ID = 'objectId'
PROJECT_ID = 'projectId'
PROJECT_NAME = 'projectName'
STATUS = 'status'
USER_FULL_NAME = 'userFullName'
class mstrio.server.job_monitor.SubscriptionType(value)

Bases: mstrio.utils.enum_helper.AutoName

An enumeration.

ALL = 'all'
ALL_INCLUDING_SNAPSHOT = 'all_including_snapshot'
CACHE = 'cache'
CAMPAIGN = 'campaign'
CLIENT = 'client'
COUNT = 'count'
CUSTOM = 'custom'
EMAIL = 'email'
FTP = 'ftp'
INBOX = 'inbox'
LAST_ONE = 'last_one'
MOBILE = 'mobile'
MOBILE_ANDROID = 'mobile_android'
MOBILE_BLACKBERRY = 'mobile_blackberry'
MOBILE_IPAD = 'mobile_ipad'
MOBILE_IPHONE = 'mobile_iphone'
PRINTER = 'printer'
RESERVED = 'reserved'
SNAPSHOT = 'snapshot'
mstrio.server.job_monitor.kill_all_jobs(connection: mstrio.connection.Connection, user: Optional[Union[User, str]] = None, description: Optional[str] = None, type: Optional[Union[mstrio.server.job_monitor.JobType, str]] = None, status: Optional[Union[mstrio.server.job_monitor.JobStatus, str]] = None, object_id: Optional[str] = None, object_type: Optional[Union[mstrio.server.job_monitor.ObjectType, str]] = None, project: Optional[Union[mstrio.server.project.Project, str]] = None, pu_name: Optional[Union[mstrio.server.job_monitor.PUName, str]] = None, subscription_type: Optional[Union[mstrio.server.job_monitor.SubscriptionType, str]] = None, subscription_recipient: Optional[Union[User, str]] = None, memory_usage: Optional[str] = None, elapsed_time: Optional[str] = None, force: bool = False, **filters) Union[mstrio.api.exceptions.Success, mstrio.api.exceptions.PartialSuccess, mstrio.api.exceptions.MstrException]

Kill jobs filtered by passed fields

Parameters
  • connection (object) –

    MicroStrategy connection object returned by

    connection.Connection()

    node(Node, str, optional): Node object or name, if not passed kill jobs

    on all nodes

  • user (User, str, optional) – Field to filter on job owner’s full name

  • match) ((exact) –

  • description (str, optional) – Field to filter on job description (partial match)

  • type (subscription) – Field to filter on job type (exact match),

  • status (JobStatus, optional) – Field to filter on job status (exact match)

  • object_id (str, optional) – Field to filter on object id (exact match)

  • object_type (ObjectType, optional) – Field to filter on object type (exact match)

  • project (Project, str, optional) – Field to filter on project name (exact match)

  • pu_name (PUName, optional) – Field to filter on processing unit name (exact match)

  • subscription_type (SubscriptionType, optional) – Field to filter on

  • type

  • subscription_recipient (User, str, optional) – Field to filter on subscription recipient’s full name (exact match)

  • memory_usage (str, optional) – Field to filter on the job elapsed time, for example ‘gt:100’ means filtering jobs with memory usage greater than to 100 MB. Valid operators are: gt - greater than lt - less than

  • elapsed_time (str, optional) – Field to filter on the job elapsed time, for example ‘gt:100’ means filtering jobs with elapsed time greater than 100 milliseconds(11.3.3+) or seconds(11.3.2). Valid operators: gt - greater than lt - less than

  • force (bool, optional) – Force flag

Returns

object if all jobs were killed PartialSuccess: if not all jobs were killed MstrException: otherwise

Return type

Success

mstrio.server.job_monitor.kill_jobs(connection: mstrio.connection.Connection, jobs: List[Union[mstrio.server.job_monitor.Job, str]]) Union[mstrio.api.exceptions.Success, mstrio.api.exceptions.PartialSuccess, mstrio.api.exceptions.MstrException]

Kill existing jobs by Job objects or job ids.

Parameters
  • connection (object) – MicroStrategy connection object returned by ‘connection.Connection()’

  • jobs – List of Job objects or job ids to kill

Returns

object if all jobs were killed PartialSuccess: if not all jobs were killed MstrException: otherwise

Return type

Success

mstrio.server.job_monitor.list_jobs(connection: Connection, node: Optional[Union[str, mstrio.server.node.Node]] = None, user: Optional[Union[User, str]] = None, description: Optional[str] = None, type: Optional[Union[mstrio.server.job_monitor.JobType, str]] = None, status: Optional[Union[mstrio.server.job_monitor.JobStatus, str]] = None, object_id: Optional[str] = None, object_type: Optional[mstrio.server.job_monitor.ObjectType] = None, project: Optional[Union[mstrio.server.project.Project, str]] = None, pu_name: Optional[Union[mstrio.server.job_monitor.PUName, str]] = None, subscription_type: Optional[Union[mstrio.server.job_monitor.SubscriptionType, str]] = None, subscription_recipient: Optional[Union[User, str]] = None, memory_usage: Optional[str] = None, elapsed_time: Optional[str] = None, sort_by: Optional[Union[mstrio.server.job_monitor.SortBy, str]] = None, to_dictionary: bool = False, limit: Optional[int] = None, **filters) Union[List[Job], List[dict]]

List jobs objects or job dictionaires. :param connection: MicroStrategy connection object returned by

connection.Connection()

Parameters
  • node (Node, str, optional) – Node object or name, if not passed list jobs on all nodes

  • user (User, str, optional) – Field to filter on job owner’s full name

  • match) ((exact) –

  • description (str, optional) – Field to filter on job description (partial match)

  • type (subscription) – Field to filter on job type (exact match),

  • status (JobStatus, optional) – Field to filter on job status (exact match)

  • object_id (str, optional) – Field to filter on object type (exact match)

  • object_type (ObjectType, optional) – Field to filter on object type (exact match)

  • project (Project, str, optional) – Field to filter on project name (exact match)

  • pu_name (PUName, optional) – Field to filter on processing unit name (exact match)

  • subscription_type (SubscriptionType, optional) – Field to filter on

  • type

  • subscription_recipient (User, str, optional) – Field to filter on subscription recipient’s full name (exact match)

  • memory_usage (str, optional) – Field to filter on the job elapsed time, for example ‘gt:100’ means filtering jobs with memory usage greater than to 100 MB. Valid operators are: gt - greater than lt - less than

  • elapsed_time (str, optional) – Field to filter on the job elapsed time, for example ‘gt:100’ means filtering jobs with elapsed time greater than 100 milliseconds(11.3.3+) or seconds(11.3.2). Valid operators: gt - greater than lt - less than

  • sort_by (SortBy, optional) – Specify sorting criteria, for example SortBy.STATUS_ASC means sorting status is ascending order or SortBy.USER_DESC means sorting user in descending order. Currently, the server supports sorting only by single field.

  • to_dictionary (bool, optional) – if True, return Schedules as list of dicts

  • limit (int, optional) – maximum number of schedules returned

  • **filters (optional) – Local filter parameters

Examples

>>> list_jobs_v1(connection, duration='gt:100')
Returns

list of Job objects or dictionaries.

Return type

Union[List[“Job”], List[dict]]

mstrio.server.job_monitor.list_jobs_v1(connection: mstrio.connection.Connection, node: Optional[Union[str, mstrio.server.node.Node]] = None, project: Optional[Union[mstrio.server.project.Project, str]] = None, status: Optional[Union[mstrio.server.job_monitor.JobStatus, str]] = None, job_type: Optional[Union[mstrio.server.job_monitor.JobType, str]] = None, user: Optional[Union[User, str]] = None, object_id: Optional[str] = None, sort_by: Optional[Union[mstrio.server.job_monitor.SortBy, str]] = None, to_dictionary: bool = False, limit: Optional[int] = None, **filters) Union[List[Job], List[dict]]

List job objects or job dictionaries. Optionally filter list. NOTE: list_jobs can return up to 1024 jobs per request.

Parameters
  • connection (object) – MicroStrategy connection object returned by ‘connection.Connection()’

  • node (Node, str, optional) – Node object or name, if not passed list jobs on all nodes

  • project (str, Project, optional) – Project id or object to filter by

  • status (JobStatus, optional) – Job status to filter by

  • job_type (JobType, optional) – Job type to filter by

  • user (User, str, optional) – User object or full name to filter by

  • object_id (str, optional) – Object id to filter by

  • sort_by (SortBy, optional) – Specifies sorting criteria to sort by

  • to_dictionary (bool, optional) – if True, return Schedules as list of dicts

  • limit (int, optional) – maximum number of schedules returned.

  • **filters

    Available filter parameters:[id, description, status, jobType, duration, jobId, objectd] - duration(str, optional): Field to filter on the job elapsed time,

    for example ‘gt:100’ means filtering jobs with elapsed time greater than to 100 seconds. Valid operators: gt - greater than lt - less than

Examples

>>> list_jobs_v1(connection, duration='gt:100')
Returns

list of Job objects or dictionaries.

Return type

Union[List[“Job”], List[dict]]

mstrio.server.node module

class mstrio.server.node.Node(name: str, address: Optional[str] = None, service_control: Optional[bool] = None)

Bases: mstrio.utils.helper.Dictable

mstrio.server.project module

class mstrio.server.project.IdleMode(value)

Bases: enum.Enum

Used to specify the exact behaviour of idle request.

REQUEST (Request Idle): all executing and queued jobs finish executing

and any newly submitted jobs are rejected.

EXECUTION (Execution Idle for All Jobs): all executing, queued, and

newly submitted jobs are placed in the queue, to be executed when the project resumes.

WAREHOUSEEXEC (Execution Idle for Warehouse jobs): all executing,

queued, and newly submitted jobs that require SQL to be submitted to the data warehouse are placed in the queue, to be executed when the project resumes. Any jobs that do not require SQL to be executed against the data warehouse are executed.

FULL (Request Idle and Execution Idle for All jobs): all executing and

queued jobs are canceled, and any newly submitted jobs are rejected.

PARTIAL (Request Idle and Execution Idle for Warehouse jobs): all

executing and queued jobs that do not submit SQL against the data warehouse are canceled, and any newly submitted jobs are rejected. Any currently executing and queued jobs that do not require SQL to be executed against the data warehouse are executed.

EXECUTION = 'exec_idle'
FULL = 'partial_idle'
PARTIAL = 'full_idle'
REQUEST = 'request_idle'
WAREHOUSEEXEC = 'wh_exec_idle'
class mstrio.server.project.Project(connection: mstrio.connection.Connection, name: Optional[str] = None, id: Optional[str] = None)

Bases: mstrio.utils.entity.Entity

Object representation of MicroStrategy Project (Project) object.

connection

A MicroStrategy connection object

settings

Project settings object

id

Project ID

name

Project name

description

Project description

alias

Project alias

type

Object type

subtype

Object subtype

ext_type

Object extended type

nodes

List of nodes on which project is loaded

date_created

Creation time, “yyyy-MM-dd HH:mm:ss” in UTC

date_modified

Last modification time, “yyyy-MM-dd

version

Version ID

owner

owner ID and name

acg

Access rights (See EnumDSSXMLAccessRightFlags for possible values)

acl

Object access control list

status

Project

ancestors

List of ancestor folders

alter(name: Optional[str] = None, description: Optional[str] = None)

Alter project name or/and description.

Parameters
  • name – new name of the project.

  • description – new description of the project.

fetch_settings() None

Fetch the current project settings from the I-Server.

idle(on_nodes: Optional[Union[str, List[str]]] = None, mode: Union[mstrio.server.project.IdleMode, str] = IdleMode.REQUEST) None

Request to idle a specific cluster node. Idle project with mode options.

Parameters
  • on_nodes – Name of node, if not passed, project will be idled on all of the nodes.

  • mode – One of: IdleMode values.

is_loaded() bool

Check if the project is loaded on any node (server).

load(on_nodes: Optional[Union[str, List[str]]] = None) None

Request to load the project onto the chosen cluster nodes. If nodes are not specified, the project will be loaded on all nodes.

Parameters

on_nodes – Name of node, if not passed, project will be loaded on all of the nodes.

register(on_nodes: Optional[Union[str, list]] = None) None

Register project on nodes.

A registered project will load on node (server) startup.

Parameters

on_nodes – Name of node, if not passed, project will be loaded on all available nodes on startup.

resume(on_nodes: Optional[Union[str, List[str]]] = None) None

Request to resume the project on the chosen cluster nodes. If nodes are not specified, the project will be loaded on all nodes.

Parameters

on_nodes – Name of node, if not passed, project will be resumed on all of the nodes.

unload(on_nodes: Optional[Union[str, List[str]]] = None) None

Request to unload the project from the chosen cluster nodes. If nodes are not specified, the project will be unloaded on all nodes. The unload action cannot be performed until all jobs and connections for project are completed. Once these processes have finished, pending project will be automatically unloaded.

Parameters

on_nodes – Name of node, if not passed, project will be unloaded on all of the nodes.

unregister(on_nodes: Optional[Union[str, list]] = None) None

Unregister project on nodes.

An unregistered project will not load on node (server) startup.

Parameters

on_nodes (str or list, optional) – Name of node, if not passed, project will not be loaded on any nodes on startup.

update_settings() None

Update the current project settings on the I-Server.

class mstrio.server.project.ProjectSettings(connection: mstrio.connection.Connection, project_id: Optional[str] = None)

Bases: mstrio.utils.settings.base_settings.BaseSettings

Object representation of MicroStrategy Project (Project) Settings.

Used to fetch, view, modify, update, export to file, import from file and validate Project settings.

The object can be optionally initialized with connection and project_id, which will automatically fetch the current settings for the specified project. If not specified, settings can be loaded from file using import_from() method. Object attributes (representing settings) can be modified manually. Lastly, the object can be applied to any project using the update() method.

connection

A MicroStrategy connection object

fetch(project_id: Optional[str] = None) None

Fetch current project settings from I-Server and update this ProjectSettings object.

Parameters

project_id – Project ID

update(project_id: Optional[str] = None) None

Update the current project settings on I-Server using this Settings object.

Parameters

project_id – Project ID

class mstrio.server.project.ProjectStatus(value)

Bases: enum.IntEnum

An enumeration.

ACTIVE = 0
ERRORSTATE = -3
EXECIDLE = 1
FULLIDLE = 7
OFFLINE = -1
OFFLINEPENDING = -2
ONLINEPENDING = -4
REQUESTIDLE = 2
WHEXECIDLE = 4
mstrio.server.project.compare_project_settings(projects: List[mstrio.server.project.Project], show_diff_only: bool = False) pandas.core.frame.DataFrame

Compares settings of project objects.

Parameters
  • projects (List[Project]) – List of project objects to compare.

  • show_diff_only (bool, optional) – Whether to display all settings or only different from first project in list.

mstrio.server.server module

class mstrio.server.server.ServerSettings(connection: mstrio.connection.Connection)

Bases: mstrio.utils.settings.base_settings.BaseSettings

Object representation of MicroStrategy I-Server Settings.

Used to fetch, view, modify, update, export to file, import from file and validate Server settings.

The object can be optionally initialized with connection, which will automatically fetch the current I-Server settings. If not specified, settings can be loaded from file using import_from() method. Object attributes (representing settings) can be modified manually. Lastly, the object can be applied to any project using the update() method.

settings

settings_value

fetch() None

Fetch current I-Server settings and update this ServerSettings object.

update() None

Update the current I-Server settings using this ServerSettings object.

Module contents