Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Methods to add tags for scheduling goals and expansion rules #119

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions src/aerie_cli/aerie_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,26 @@ def get_activity_interface(self, activity_name: str, model_id: int) -> str:
)
return data["typescriptFiles"][0]["content"]

def add_expansion_rule_tag(self, rule_id: int, tag_name: str):
add_expansion_rule_tag_query = """
mutation AddTagToExpansionRule($rule_id: Int, $tag_id: Int) {
insert_expansion_rule_tags(objects: {rule_id: $rule_id, tag_id: $tag_id}) {
returning {
tag_id
}
}
}
"""

#add tag to expansion rule
resp = self.aerie_host.post_to_graphql(
add_expansion_rule_tag_query,
rule_id=rule_id,
tag_id=self.get_tag_id_by_name(tag_name)
)

return resp['returning'][0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return resp['returning'][0]
return resp['returning'][0]["tag_id"]


def create_expansion_rule(
self,
expansion_logic: str,
Expand Down Expand Up @@ -1505,6 +1525,26 @@ def get_scheduling_goals_by_specification(self, spec_id):
resp = self.aerie_host.post_to_graphql(list_all_goals_by_spec_query, spec=spec_id)

return resp

def add_scheduling_goal_tag(self, goal_id: int, tag_name: str):
add_goal_tag_query = """
mutation AddTagToSchedulingGoal($goal_id: Int, $tag_id: Int) {
insert_scheduling_goal_tags(objects: {goal_id: $goal_id, tag_id: $tag_id}) {
returning {
tag_id
}
}
}
"""

#add tag to scheduling goal
resp = self.aerie_host.post_to_graphql(
add_goal_tag_query,
goal_id=goal_id,
tag_id=self.get_tag_id_by_name(tag_name)
)

return resp['returning'][0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return resp['returning'][0]
return resp['returning'][0]["tag_id"]


def upload_scheduling_goal(self, model_id, name, definition):
obj = dict()
Expand Down
Loading