-
Notifications
You must be signed in to change notification settings - Fork 4
Conversation
2afcfd9
to
0cb110a
Compare
19d3644
to
c288e17
Compare
ec0e647
to
d65c2fe
Compare
Tests will fail as the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, we since we have the actions
for accept, reject, accept_curate, we can add the decision there. It's ok to keep the endpoint too
@@ -30,8 +30,41 @@ def has_permission(self, request): | |||
) | |||
|
|||
|
|||
class ModelAdmin(admin.ModelAdmin): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rename it, not to have the same name as the admin module
workflow_id = request.data.get("workflow_id") | ||
action = request.data.get("action") | ||
|
||
if not all([workflow_id, action]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's why we have the serializer :) we can check if it's valid and then save
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewing. Same approach was also implemented in the WorkflowTicketViewSet
should be reviewed as well
https://github.com/inspirehep/backoffice/blob/main/backoffice/backoffice/workflows/api/views.py#L84
Ticket created cern-sis/issues-inspire#544
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thanks for creating the issue, on django it's a best practise to use the serializer for validation
accept_curate = "accept_curate", "author_create_approved_dag" | ||
|
||
|
||
DECISION_CHOICES = ResolutionDags.choices + [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why + []
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was so I would remember to add the decisions regarding other stuff in the future. Remove
60d5d81
to
641708c
Compare
.github/workflows/test-workflows.yml
Outdated
@@ -51,6 +51,7 @@ jobs: | |||
-v "$(pwd)"/tests:/opt/airflow/tests | |||
-v "$(pwd)"/requirements-test.txt:/opt/airflow/requirements-test.txt | |||
-v "$(pwd)"/data:/opt/airflow/data | |||
-v "$(pwd)"/scripts/connections/connections.json:/opt/airflow/connections.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at the end we can mount all the scripts directory :)
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def add_decision(workflow_id, user, action): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's have a quick discussion about that :)
dc2d3fd
to
99a2fd5
Compare
99a2fd5
to
4a4c9f1
Compare
4278bf5
to
067e814
Compare
067e814
to
0494814
Compare
@DonHaul also here could you please fix the commit message? :) Is too long and we should be consistent with https://confluence.cern.ch/display/RCSSIS/Contributing+Guidelines |
0494814
to
96b660d
Compare
* Decision is now added on the /resolve api * ref: cern-sis/issues-inspire/issues/522
96b660d
to
f658c3d
Compare
Besides Implementing the decision logic. I propose also two main changes in how we interact with airflow.
workflowticket_management_hook