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

refactor srm srv for detail states and comment #839

Merged
merged 2 commits into from
Feb 3, 2025

Conversation

raylrui
Copy link
Contributor

@raylrui raylrui commented Jan 30, 2025

Sequence Run Manager service refactor

  1. add detail state record for srm_srv states
  2. add comment for "Sequence completed", "Sequence completed. But failed in post analysis process.", and "Sequence failed."

fix #848

Comment on lines 35 to 54
# sequence status in SUCCEEDED:
# if transition from STARTED to SUCCEEDED, set comment to "Sequence complete"
# if transition from FAILED to SUCCEEDED, set comment to "Conversion re-triggered, and sequence completed.'
if sequence.status == SequenceStatus.SUCCEEDED:
previous_state = State.objects.filter(sequence=sequence).order_by('-timestamp').first()
if previous_state is not None and SequenceStatus.from_seq_run_status(previous_state.status) == SequenceStatus.STARTED:
comment = "Sequence completed. Now in state " + status + " ."
if previous_state is not None and SequenceStatus.from_seq_run_status(previous_state.status) == SequenceStatus.FAILED:
comment = "Conversion re-triggered, and sequence completed. Now in state " + status + " ."

# sequence status in FAILED:
# if transition from SUCCEEDED to FAILED, set comment to "Sequence completed. But failed in post analysis process."
# if transition from STARTED to FAILED, set comment to "Sequence failed. Now in state " + status + " ."
if sequence.status == SequenceStatus.FAILED:
previous_state = State.objects.filter(sequence=sequence).order_by('-timestamp').first()
if previous_state is not None and SequenceStatus.from_seq_run_status(previous_state.status) == SequenceStatus.SUCCEEDED:
comment = "Sequence completed. But failed in post analysis process."
else:
comment = "Sequence failed. Now in state " + status + " ."

Copy link
Member

Choose a reason for hiding this comment

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

All this is to set a comment?

I don't think that's needed. With the separation of state and status, it should be quite clear what's going on.
I'd preserve the comments for irregular, unpredictable, manual user added text rather than being auto-populated.
(if something is predictable and can be auto-generated I always feel it should be in a structured format and not in free text, and with the state / status we have that already)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, sure, these can be removed as redundant for states.

@raylrui raylrui added this pull request to the merge queue Feb 3, 2025
Merged via the queue into main with commit 593bcd9 Feb 3, 2025
6 checks passed
@raylrui raylrui deleted the feat/srm-state-srv-improve branch February 3, 2025 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SRM add detail state record
2 participants