plynx.db.node_collection_manager

Node collection manager and utils

Module Contents

plynx.db.node_collection_manager._PROPERTIES_TO_GET_FROM_SUBS = ['node_running_status', 'logs', 'outputs', 'cache_url'][source]
class plynx.db.node_collection_manager.NodeCollectionManager(collection: str)[source]

NodeCollectionManager contains all the operations to work with Nodes in the database.

get_db_objects(self, status: Union[List[str], str] = '', node_kinds: Union[None, str, List[str]] = None, search: str = '', per_page: int = 20, offset: int = 0, user_id: Optional[ObjectId] = None)[source]

Get subset of the Objects.

Args:
status (str, None): Node Running Status search (str, None): Search pattern per_page (int): Number of Nodes per page offset (int): Offset
Return:
(list of dict) List of Nodes in dict format
get_db_objects_by_ids(self, ids: Union[List[ObjectId], List[str]], collection: Optional[str] = None)[source]

Find all the Objects with a given IDs.

Args:
ids (list of ObjectID): Object Ids
_update_sub_nodes_fields(self, sub_nodes_dicts: List[Dict], reference_node_id: str, target_props: List[str], reference_collection: Optional[str] = None)[source]
get_db_node(self, node_id: ObjectId, user_id: Optional[ObjectId] = None)[source]

Get dict representation of a Node.

Args:
node_id (ObjectId, str): Object ID user_id (str, ObjectId, None): User ID
Return:
(dict) dict representation of the Object
get_db_object(self, object_id: ObjectId, user_id: Optional[ObjectId] = None)[source]

Get dict representation of an Object.

Args:
object_id (ObjectId): Object ID user_id (ObjectId, None): User ID
Return:
(dict) dict representation of the Object
static _transplant_node(node: Node, dest_node: Node)[source]
upgrade_sub_nodes(self, main_node: Node)[source]

Upgrade deprecated Nodes.

The function does not change the original graph in the database.

Return:
(int): Number of upgraded Nodes
pick_node(self, kinds: List[str])[source]

Get node and set status to RUNNING in atomic way