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

Sessions changes #87

Merged
merged 41 commits into from
Oct 20, 2023
Merged

Sessions changes #87

merged 41 commits into from
Oct 20, 2023

Conversation

beckykd
Copy link
Collaborator

@beckykd beckykd commented Oct 6, 2023

closes #124

Eric-Arellano
Eric-Arellano previously approved these changes Oct 6, 2023
@Eric-Arellano Eric-Arellano dismissed their stale review October 6, 2023 22:07

reviewed prematurely. should have sign off from SMEs

docs/run/run-sessions.mdx Outdated Show resolved Hide resolved
@jyu00
Copy link
Collaborator

jyu00 commented Oct 16, 2023

I think we can take this opportunity to restructure the page a bit, so topics related to how session works are grouped together. For example:

# The mechanics of sessions

For each backend, the first job in the session waits its turn in the queue normally. 
When the first job starts running, the session becomes active. 
Jobs within an active session take priority over any other queued jobs (but not system jobs such as calibration). 

A quantum processor still executes one job at a time. Therefore, jobs that belong to a session still need to wait for their turn if one is already running.

<the following paragraph is taken from "How long a session stays active">

The length of time a session is active is controlled by the maximum session timeout (`max_time`) value 
and the interactive timeout value (ITTL, or interactive time to live). 
The `max_time` timer starts when the session becomes active - that is, when the first job runs, not when it is queued. 
It does not stop if a session becomes inactive. The ITTL timer starts each time a session job finishes.

## Maximum session timeout

...

## Interactive timeout value

...

## What happens when a session ends

... 

## Querying session status

You can query the status of a session using `session.status()`. 

Session status can be one of the following:

- `Pending`: Session has not started or has been deactivated. 
- `In progress, accepting new jobs`: session is active and accepting new jobs.
- `In progress, not accepting new jobs`: session is active but not accepting new jobs. Job submission to the session will be rejected, but outstanding session jobs will run to completion. The session will be automatically closed once all jobs finish. 
- `Closed`: Session maximum timeout value has been reached, or session was explicitly closed.

## Summary

- Jobs within an active session take priority over other queued jobs
- A session becomes active when its first job starts running
- A session stays active until
  - Its maximum timeout value is reached. In this case all queued jobs are cancelled, but running jobs would finish. 
  - Its interactive timeout value is reached. In this case the session is deactivated but can be resumed when the next job starts running. 
  - The session is closed or cancelled by the user
- `session.status()` can be used to query session status. `session.details()` can be used to query the timeout values. 

# Different ways of using session

<This section should be moved to "run jobs in a session" with code example, but that can be later>

Sessions can be used for iterative or batch execution.

...

@beckykd
Copy link
Collaborator Author

beckykd commented Oct 16, 2023

I think we can take this opportunity to restructure the page a bit, so topics related to how session works are grouped together. For example:

I'm totally on board with that. Do you want me to get rid of the session details section? I see that it's mentioned in the summary, so I'm going to put the summary after the session details section

docs/run/sessions.mdx Outdated Show resolved Hide resolved
docs/run/sessions.mdx Outdated Show resolved Hide resolved
docs/run/sessions.mdx Outdated Show resolved Hide resolved
docs/run/sessions.mdx Outdated Show resolved Hide resolved
docs/run/sessions.mdx Outdated Show resolved Hide resolved
docs/run/run-sessions.mdx Outdated Show resolved Hide resolved
docs/run/run-sessions.mdx Outdated Show resolved Hide resolved
@jyu00
Copy link
Collaborator

jyu00 commented Oct 16, 2023

I'm totally on board with that. Do you want me to get rid of the session details section? I see that it's mentioned in the summary, so I'm going to put the summary after the session details section

Session details section is still needed, since that's how people find out about the TTLs. I was debating if we should move everything code related to Run jobs in a session and keep this page as concept only. What do you think?

@beckykd
Copy link
Collaborator Author

beckykd commented Oct 16, 2023

Summary

...

  • A session stays active until
    • Its maximum timeout value is reached. In this case all queued jobs are cancelled, but running jobs would finish.
    • Its interactive timeout value is reached. In this case the session is deactivated but can be resumed when the next job starts running.
    • The session is closed or cancelled by the user

It seems like there's a 4th way a session is closed: The context manager is exited and all session jobs are finished.

Right? Because it will be ended immediately after the jobs are done without the session reaching the max timeout value or reaching the interactive timeout value.

@jyu00
Copy link
Collaborator

jyu00 commented Oct 16, 2023

Summary

...

  • A session stays active until

    • Its maximum timeout value is reached. In this case all queued jobs are cancelled, but running jobs would finish.
    • Its interactive timeout value is reached. In this case the session is deactivated but can be resumed when the next job starts running.
    • The session is closed or cancelled by the user

It seems like there's a 4th way a session is closed: The context manager is exited and all session jobs are finished.

It's the same as calling session.closed(). We can change the wording to say something like

- The session is closed or cancelled. This can be done using the corresponding methods or upon exiting a session context.

@beckykd
Copy link
Collaborator Author

beckykd commented Oct 16, 2023

Session details section is still needed, since that's how people find out about the TTLs. I was debating if we should move everything code related to Run jobs in a session and keep this page as concept only. What do you think?

I think that makes sense - I can rearrange.

Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>
@beckykd
Copy link
Collaborator Author

beckykd commented Oct 20, 2023

"Session maximum execution time" in max-execution-time can just go away.

In that section we tell them how to change the maximum execution time though. Don't we still want that? I could delete the Defaults section if we really don't want to tell them (https://docs.quantum-computing.ibm.com/run/max-execution-time#defaults)

We tell them how to set mac time in run-jobs-in-session, so we deleted this section, including the defaults.

Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>
Copy link
Collaborator

@jyu00 jyu00 left a comment

Choose a reason for hiding this comment

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

Thank you @beckykd!

docs/run/max-execution-time.mdx Show resolved Hide resolved
@beckykd beckykd changed the title Sessions changes: DO NOT MERGE Sessions changes Oct 20, 2023
@beckykd beckykd merged commit ec3ff25 into main Oct 20, 2023
4 checks passed
@beckykd beckykd deleted the sessions-changes branch October 20, 2023 16:13
frankharkins pushed a commit to frankharkins/documentation that referenced this pull request Jul 22, 2024
closes Qiskit#124 

Changes from these PRs:

- [x] 1 min TTL:
***REMOVED***
and
***REMOVED***
(request from @mriedem - instead of documenting this change, just tell
users to look up the TTL from the session)
- [x] Get session details:
***REMOVED*** (see
***REMOVED***
- [x] Limit max TTL per plan:
***REMOVED***
- [x] Accepting jobs flag:
***REMOVED***
- [x] The UI is also changing:
***REMOVED***

FYI - @jyu00 and @mriedem

- [x] Need to clearly state that these changes are for
qiskit-ibm-runtime version >= 0.13.0

No longer in scope:
- [ ] Extended sessions:
***REMOVED*** and
***REMOVED***

This epic should contain all of the Sessions changes:
***REMOVED***

---------

Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>
Co-authored-by: abbycross <across@us.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Sessions changes
6 participants