Skip to content

Commit

Permalink
Update from 1319-rename-dependent-to-depends (#125)
Browse files Browse the repository at this point in the history
* 1319: Rename unterminated_depends_on_subscriptions to in_use_by

* bumpversion to 0.4.0-rc4

Co-authored-by: tjeerddie <tjeerdverschragen@hotmail.com>
  • Loading branch information
github-actions[bot] and tjeerddie authored Mar 18, 2022
1 parent 8f0e76f commit ba543d3
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.4.0-rc3
current_version = 0.4.0-rc4
commit = False
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)((\-rc)(?P<build>\d+))?
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/application/openapi.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/architecture/application/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ These workflows have more in common with each other than not, it's mostly a matt
By default, the associated workflow can only be run on a subscription with a lifecycle state set to `ACTIVE`. This behavior can be changed in the following data structure in the `workflows/__init__.py` file:

```python
from orchestrator.services.subscriptions import WF_BLOCKED_BY_DEPENDS_ON_SUBSCRIPTIONS
from orchestrator.services.subscriptions import WF_BLOCKED_BY_IN_USE_BY_SUBSCRIPTIONS

WF_USABLE_MAP.update(
{
Expand Down
2 changes: 1 addition & 1 deletion orchestrator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

"""This is the orchestrator workflow engine."""

__version__ = "0.4.0-rc3"
__version__ = "0.4.0-rc4"

from orchestrator.app import OrchestratorCore
from orchestrator.settings import app_settings, oauth2_settings
Expand Down
4 changes: 2 additions & 2 deletions orchestrator/schemas/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ class WorkflowListItemSchema(OrchestratorBaseModel):
status: Optional[str]
action: Optional[str]
locked_relations: Optional[List[UUID]]
# unterminated_parents deprecated since "0.4.0" renamed to unterminated_depends_on_subscriptions
# unterminated_parents deprecated since "0.4.0" renamed to unterminated_in_use_by_subscriptions
unterminated_parents: Optional[List[UUID]]
unterminated_depends_on_subscriptions: Optional[List[UUID]]
unterminated_in_use_by_subscriptions: Optional[List[UUID]]


class SubscriptionWorkflowListsSchema(OrchestratorBaseModel):
Expand Down
22 changes: 11 additions & 11 deletions orchestrator/services/subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def status_relations(subscription: SubscriptionTable) -> Dict[str, List[UUID]]:
"""
in_use_by_query = query_in_use_by_subscriptions(subscription.subscription_id)

unterminated_depends_on_subscriptions = _terminated_filter(in_use_by_query)
unterminated_in_use_by_subscriptions = _terminated_filter(in_use_by_query)
locked_in_use_by_block_relations = _in_sync_filter(in_use_by_query)

depends_on_query = query_depends_on_subscriptions(subscription.subscription_id)
Expand All @@ -466,9 +466,9 @@ def status_relations(subscription: SubscriptionTable) -> Dict[str, List[UUID]]:

result = {
"locked_relations": locked_in_use_by_block_relations + locked_depends_on_block_relations,
# unterminated_parents deprecated since "0.4.0", renamed to unterminated_depends_on_subscriptions
"unterminated_parents": unterminated_depends_on_subscriptions,
"unterminated_depends_on_subscriptions": unterminated_depends_on_subscriptions,
# unterminated_parents deprecated since "0.4.0", renamed to unterminated_in_use_by_subscriptions
"unterminated_parents": unterminated_in_use_by_subscriptions,
"unterminated_in_use_by_subscriptions": unterminated_in_use_by_subscriptions,
}

logger.debug(
Expand Down Expand Up @@ -496,9 +496,9 @@ def get_relations(subscription_id: UUIDstr) -> Dict[str, List[UUID]]:

WF_USABLE_MAP: Dict[str, List[str]] = {}

# WF_BLOCKED_BY_PARENTS deprecated since "0.4.0", renamed to WF_BLOCKED_BY_DEPENDS_ON_SUBSCRIPTIONS
# WF_BLOCKED_BY_PARENTS deprecated since "0.4.0", renamed to WF_BLOCKED_BY_IN_USE_BY_SUBSCRIPTIONS
WF_BLOCKED_BY_PARENTS: Dict[str, bool] = {}
WF_BLOCKED_BY_DEPENDS_ON_SUBSCRIPTIONS: Dict[str, bool] = {}
WF_BLOCKED_BY_IN_USE_BY_SUBSCRIPTIONS: Dict[str, bool] = {}

WF_USABLE_WHILE_OUT_OF_SYNC: List[str] = ["modify_note"]

Expand Down Expand Up @@ -560,20 +560,20 @@ def subscription_workflows(subscription: SubscriptionTable) -> Dict[str, Any]:
workflow_json["action"] = "terminated" if workflow.target == Target.TERMINATE else "modified"

# Check if this workflow is blocked because there are unterminated relations
blocked_by_depends_on_subscriptions = WF_BLOCKED_BY_DEPENDS_ON_SUBSCRIPTIONS.get(
blocked_by_depends_on_subscriptions = WF_BLOCKED_BY_IN_USE_BY_SUBSCRIPTIONS.get(
workflow.name, workflow.target == Target.TERMINATE
)

# WF_BLOCKED_BY_PARENTS deprecated since "0.4.0", renamed to WF_BLOCKED_BY_DEPENDS_ON_SUBSCRIPTIONS
# WF_BLOCKED_BY_PARENTS deprecated since "0.4.0", renamed to WF_BLOCKED_BY_IN_USE_BY_SUBSCRIPTIONS
if not blocked_by_depends_on_subscriptions:
blocked_by_depends_on_subscriptions = WF_BLOCKED_BY_PARENTS.get(
workflow.name, workflow.target == Target.TERMINATE
)
if blocked_by_depends_on_subscriptions and data["unterminated_depends_on_subscriptions"]:
if blocked_by_depends_on_subscriptions and data["unterminated_in_use_by_subscriptions"]:
workflow_json["reason"] = "subscription.no_modify_subscription_in_use_by_others"
# unterminated_parents deprecated since "0.4.0", renamed to unterminated_depends_on_subscriptions
# unterminated_parents deprecated since "0.4.0", renamed to unterminated_in_use_by_subscriptions
workflow_json["unterminated_parents"] = data["unterminated_parents"]
workflow_json["unterminated_depends_on_subscriptions"] = data["unterminated_depends_on_subscriptions"]
workflow_json["unterminated_in_use_by_subscriptions"] = data["unterminated_in_use_by_subscriptions"]
workflow_json["action"] = "terminated" if workflow.target == Target.TERMINATE else "modified"

workflows[workflow.target.lower()].append(workflow_json)
Expand Down

0 comments on commit ba543d3

Please sign in to comment.