You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Proposal: Unified Data Model For Texera Resources
#9690
As illustrated in #9394 , today's Texera's resource management are scattered and ad-hoc. This reflects in Texera's current relational model
This model has three limitations:
Duplicated resource definition: each of the seven kinds has its own identifier, such as wid, did, and mid, and repeats the attributes they all share, such as the name. A new kind has to repeat them again.
Scattered resource access control: own and access are defined once per kind, which gives ten relationships for two ideas. They also differ by kind: a warehouse and an environment cannot be shared, and an execution has neither.
Incomplete resource lineage: only an execution records lineage, through four relationships. Nothing records which dataset versions a workflow version reads, which ones an execution produces, or which environment it used.
Part 1 addresses the first two limitations, and Parts 2 and 3 address the third.
Part 1: Unified Resource And Resource Access
Unified Resource
Today each kind of resource, such as a workflow, a dataset, or a computing unit, is its own entity, with its own identifier and its own relationships to User. I propose one supertype, Resource, and making every kind a subtype of it through an ISA relationship. Resource holds what all kinds share, starting with one identifier, rid, and each kind keeps only the attributes and relationships that are specific to it.
For example, here is what Resource keeps and what each kind keeps:
Resource: keeps what every kind has, which is rid, kind, name, description, and creation time.
Workflow: keeps its content, which is the operators and links on its canvas.
Dataset: keeps its repository, which is where its files are stored.
Model: keeps its framework, such as PyTorch.
Computing Unit: keeps its type, such as Kubernetes, and its uri, which is its address.
Warehouse: keeps its bucket, which is where the results of executions are stored.
Environment: keeps its packages, which are the Python packages it installs.
Execution: keeps its status, such as running or completed.
So the workflow "Iris classifier" has its name, description, and creation time in Resource, and its content in Workflow. The attributes listed for each kind are representative ones, not all of them.
I think this has two benefits:
Shared parts are modeled once: an attribute or a relationship defined on Resource, such as the name or access, applies to every kind through inheritance.
A new kind is cheap to add: it is one more entity under Resource, and it inherits everything Resource already has.
Resource Access
Access is modeled between User and Resource, so every kind inherits it. I see two alternative designs. Both keep created by as its own relationship, which records the user who created the resource. They differ in whether own is also its own relationship or a level of access.
Design A: Separate Own And Access
In this design User and Resource have three relationships:
created by: every resource is created by exactly one user.
own: every resource is owned by exactly one user.
access: a resource is shared with any number of users, each at the level read or write.
Design B: Own As A Level Of Access
In this design own and access are combined into one access relationship with three levels, and created by stays as it is in Design A:
created by: every resource is created by exactly one user.
access: a resource is accessed by any number of users, each at the level own, read, or write.
Recommendation
I prefer Design A, for two reasons:
It is semantically more accurate: owning a resource is a different relationship from having access to it, so own is its own relationship rather than a level of access.
It constrains ownership by cardinality: own is many-to-one, and every resource takes part in it, so the database can enforce that every resource has exactly one owner. In Design B, that is a rule kept outside the model.
Part 2: Versions And Version Access
Three kinds of resources have versions today: workflows, datasets, and models. I propose adding environments as a fourth, and giving each of the four its own version entity, so a Workflow has Workflow Versions, a Dataset has Dataset Versions, a Model has Model Versions, and an Environment has Environment Versions. Every version belongs to exactly one resource. The other kinds, such as computing units, have no version entity.
I propose modeling each version entity as a weak entity. A version has no identifier of its own: it is identified by the rid of the resource it belongs to, together with its own version number, vno. For example, the third version of workflow 7 is identified by rid 7 and vno 3. In the diagram below, a double border marks a weak entity and the relationship that identifies it, and a dashed underline marks its partial key.
Access to a version comes from its resource. As in Part 1, access is only between User and Resource, and a version has no access of its own. For example, a user who can read the dataset "Iris flowers" can read every version of it, including versions added later.
Part 3: Lineage
Lineage records how resources and their versions depend on each other, and who started each execution. I propose modeling each kind of dependency as its own relationship:
reads: a workflow version reads the dataset versions it takes as input.
executes: an execution executes exactly one workflow version.
starts: a user starts an execution, and every execution is started by exactly one user.
hosts: a computing unit hosts the executions that run on it.
uses: an execution uses the environment versions that its Python UDF operators run in.
stores: a warehouse stores the results of the executions that write to it.
exports: an execution exports the dataset versions it produces.
As a result, a dataset version can be traced back to the execution that exported it, and from there to the workflow version it executed, the dataset versions that workflow version read, the user who started it, the computing unit that hosted it, the environment versions it used, and the warehouse that stores its results. The diagram shows these seven relationships; other pairs, such as an execution exporting a model version, are added the same way. Access works as in Parts 1 and 2 and is left out of the diagram.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Existing Data Model
As illustrated in #9394 , today's Texera's resource management are scattered and ad-hoc. This reflects in Texera's current relational model
This model has three limitations:
wid,did, andmid, and repeats the attributes they all share, such as the name. A new kind has to repeat them again.ownandaccessare defined once per kind, which gives ten relationships for two ideas. They also differ by kind: a warehouse and an environment cannot be shared, and an execution has neither.Part 1 addresses the first two limitations, and Parts 2 and 3 address the third.
Part 1: Unified Resource And Resource Access
Unified Resource
Today each kind of resource, such as a workflow, a dataset, or a computing unit, is its own entity, with its own identifier and its own relationships to
User. I propose one supertype,Resource, and making every kind a subtype of it through an ISA relationship.Resourceholds what all kinds share, starting with one identifier,rid, and each kind keeps only the attributes and relationships that are specific to it.For example, here is what
Resourcekeeps and what each kind keeps:rid,kind,name,description, andcreation time.content, which is the operators and links on its canvas.repository, which is where its files are stored.framework, such as PyTorch.type, such as Kubernetes, and itsuri, which is its address.bucket, which is where the results of executions are stored.packages, which are the Python packages it installs.status, such as running or completed.So the workflow "Iris classifier" has its name, description, and creation time in
Resource, and its content inWorkflow. The attributes listed for each kind are representative ones, not all of them.I think this has two benefits:
Resource, such as the name or access, applies to every kind through inheritance.Resource, and it inherits everythingResourcealready has.Resource Access
Access is modeled between
UserandResource, so every kind inherits it. I see two alternative designs. Both keepcreated byas its own relationship, which records the user who created the resource. They differ in whetherownis also its own relationship or a level ofaccess.Design A: Separate Own And Access
In this design
UserandResourcehave three relationships:Design B: Own As A Level Of Access
In this design
ownandaccessare combined into oneaccessrelationship with three levels, andcreated bystays as it is in Design A:Recommendation
I prefer Design A, for two reasons:
ownis its own relationship rather than a level ofaccess.ownis many-to-one, and every resource takes part in it, so the database can enforce that every resource has exactly one owner. In Design B, that is a rule kept outside the model.Part 2: Versions And Version Access
Three kinds of resources have versions today: workflows, datasets, and models. I propose adding environments as a fourth, and giving each of the four its own version entity, so a
WorkflowhasWorkflow Versions, aDatasethasDataset Versions, aModelhasModel Versions, and anEnvironmenthasEnvironment Versions. Every version belongs to exactly one resource. The other kinds, such as computing units, have no version entity.I propose modeling each version entity as a weak entity. A version has no identifier of its own: it is identified by the
ridof the resource it belongs to, together with its own version number,vno. For example, the third version of workflow 7 is identified byrid7 andvno3. In the diagram below, a double border marks a weak entity and the relationship that identifies it, and a dashed underline marks its partial key.Access to a version comes from its resource. As in Part 1,
accessis only betweenUserandResource, and a version has no access of its own. For example, a user who can read the dataset "Iris flowers" can read every version of it, including versions added later.Part 3: Lineage
Lineage records how resources and their versions depend on each other, and who started each execution. I propose modeling each kind of dependency as its own relationship:
As a result, a dataset version can be traced back to the execution that exported it, and from there to the workflow version it executed, the dataset versions that workflow version read, the user who started it, the computing unit that hosted it, the environment versions it used, and the warehouse that stores its results. The diagram shows these seven relationships; other pairs, such as an execution exporting a model version, are added the same way. Access works as in Parts 1 and 2 and is left out of the diagram.
All reactions