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

KOJO-127 | StateTransitionLogger LADR #74

Open
wants to merge 2 commits into
base: 4.x
Choose a base branch
from

Conversation

mucha55
Copy link
Contributor

@mucha55 mucha55 commented Aug 8, 2019

No description provided.

@mucha55 mucha55 requested review from rhift and alexberryman August 8, 2019 18:59
@mucha55 mucha55 self-assigned this Aug 8, 2019
Job state transitions are persisted to RDBMS in `Neighborhoods\Kojo\State\Service::applyRequest()`.
To that logic we will add another `INSERT` into a new table: `kojo_job_state_transitions` (working title).
The schema of that table will include all job information (ID, type, etc.) as well as process information (execution environment, PID, etc.).
Those two statements will be wrapped in a database transaction to ensure that nothing is written to `kojo_job_state_transitions` unless the actual transition succeeds.
Copy link
Contributor

Choose a reason for hiding this comment

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

@mucha55 how are you planning on using PDO to accomplish this with user-land transactions? testing PDO::inTransaction?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doctrine DBAL supports "nested" transactions, but even without them this is fine: If there's a userspace transaction happening, because it being rolled back will mean the job state never changes, which means there shouldn't be anything written to kojo_job_state_transitions anyway

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Per an offline discussion, we have to use \PDO for managing the transaction, since a Doctrine Connection isn't aware of what happens in the \PDO connection that it was instantiated with

Copy link
Contributor

@alexberryman alexberryman left a comment

Choose a reason for hiding this comment

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

I'd also like to see an example of the message format that the StateTransitionLogger would be emitting. You can use a placeholder for the Execution Env info object that I'm working on creating now.

There are multiple unknowns with this design which could cause it to become infeasible to implement, in which case we'd have to go with the approach outlined in Alternative 3.

## Unresolved Questions
* Should we log when a job is created (i.e. scheduled)?
Copy link
Contributor

Choose a reason for hiding this comment

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

On the surface I would answer "yes". When an execution cluster is constrained on resources or limited by process pool size, there may be jobs that never exit the waiting state. In this condition, we'd never see a StateTransitionLogger message about that job, and only polling kojo_job would display it.

Is there an implementation detail that makes logging on creation difficult?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After we talked through the implementation a little bit last week, I realized that including job creation is easier than not including it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants