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

[Documentation Code Camp] - Added introductory section for queue documentation - Part 1 #889

Merged
merged 2 commits into from
Apr 26, 2024

Conversation

marcus-oscarsson
Copy link
Member

No description provided.

@marcus-oscarsson
Copy link
Member Author

This is still very much in progress, Ill try to add a bit more introduction and some figures that might make things easier to understand. Then Ill go on with some more details that will point out where things are implemented and how new tasks are created.

@marcus-oscarsson
Copy link
Member Author

If you think about something that you'd like to know Id try to add it, I'm not promising that it will be any clearer but it least it will be documented ;)

@rhfogh
Copy link
Collaborator

rhfogh commented Mar 18, 2024

I do have one. As I understood the old system, there was a single source of truth, specifically the tree of QueueModelObjects. But (again as I understood it) MxcubeWeb introduced a new data structure that served as a competing source of truth that could be queried or modified independently. I'd like to understand what both those structures are and how they interact.

@marcus-oscarsson
Copy link
Member Author

Ill try to clarify that, the queue is the same in both Qt and Web, still the same old tree of QueueModelObjects but ill try to clarify that. The creation of the nodes differ slightly a bit but it should otherwise be the same.

Copy link
Contributor

@fabcor-maxiv fabcor-maxiv left a comment

Choose a reason for hiding this comment

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

Same suggestion I made for the other pull requests: when dealing with markup I tend to prefer Semantic Line Breaks. It is a personal preference, as far as I know we do not have a policy for this, so feel free to follow it, to whatever degree you feel comfortable with, or not at all.

Copy link
Contributor

@fabcor-maxiv fabcor-maxiv left a comment

Choose a reason for hiding this comment

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

Looks good overall

@marcus-oscarsson marcus-oscarsson force-pushed the mo-march-queue-doc branch 4 times, most recently from 3f6c69b to 2f2ee99 Compare March 21, 2024 12:59
@marcus-oscarsson
Copy link
Member Author

I'm sorry @axelboc but I'm not done yet its still very much work in progress this but ill make a diagram as well

### Differences between the Web and the Qt user interfaces
When the Web interface was designed, the scientists wanted to change some aspects of how the queue operates and how it is presented to the user. The decision was to work on one sample at a time, rather than for the entire queue, as is done in the Qt version. This also means that the Web interface is centered around displaying the contents of the queue for one sample. It was also decided to not display `DataCollectionGroupQueueEntry` in the queue. The `DataCollectionGroupQueueEntry` still exists in the Web interface, but there is no view created for it.

On a technical level, there is a tight coupling between the `QueueEntry` base class to a Qt view object that makes the creation of the object slightly different between the two user interfaces (Qt and Web). To handle the tight coupling to Qt a `Mock` object used in the Web version instead of a Qt view and the handling of the updating of the view in the web version handled through signals passed over websockets to the client.
Copy link
Contributor

Choose a reason for hiding this comment

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

To handle the tight coupling to Qt a Mock object used in the Web version instead of a Qt view and the handling of the updating of the view in the web version handled through signals passed over websockets to the client.

This sentence might be better if split in two????? So the Web has a Mock object to mimic the Qt?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, you are right. That sentence is a a bit convoluted

Copy link
Member Author

@marcus-oscarsson marcus-oscarsson Mar 22, 2024

Choose a reason for hiding this comment

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

"This sentence might be better if split in two????? So the Web has a Mock object to mimic the Qt?"

Yes

@marcus-oscarsson marcus-oscarsson force-pushed the mo-march-queue-doc branch 6 times, most recently from fe40da5 to f194459 Compare March 22, 2024 08:55
@rhfogh
Copy link
Collaborator

rhfogh commented Mar 22, 2024

AH, one question here:

In the diagram it is shown with Samples always at the top ()makes sense) and with only one level of DataCollectionGroup. Is that a rule, just common practice, or a coincidence? When running multisweep workflow experiments, it arguably makes more sense to have multiple levels or groupings, a group for the entire workflow, containing another group for teh characterisation, and yet another group for the actual acquisition sweeps. And indeed this is how I have coded the GPhL workflow. I think we need to decide whether we accept multiple levels of groupings or not, and make it explicit in the documentation, otherwise people will start making incorrect assumptions and different bits of code can clash.

@rhfogh rhfogh self-requested a review March 22, 2024 10:19
Copy link
Collaborator

@rhfogh rhfogh left a comment

Choose a reason for hiding this comment

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

We need to sort out the question of whether nested groups are allowed or not.

Great with the diagrams, BTW, that makes everything a lot clearer.


This design was thought to map well to the semantics of how data is collected with a sample changer and the upload of metadata to LIMS. The sample changer has a number of samples, each having a set of data collections (child nodes). The results are uploaded to the lims system after each data collection, (`post_execute`). Workflow engines can further group native collection protocols into grouping nodes, which in turn can be used as building blocks for even more complex collection strategies.

```{figure} /assets/queue_execute_methods.svg
Copy link
Contributor

Choose a reason for hiding this comment

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

This file is missing

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, I'm aware, I'm still working on it. Also trying to get the scaling to work

@marcus-oscarsson
Copy link
Member Author

marcus-oscarsson commented Mar 22, 2024

@rhfogh, I'm still working on this section and ill try to make some notes on whats common practice between what is possible. There is no decision on how deep one can nest data collection groups or samples for that matter. Its left open by purpose. The conventional one crystal type per pin with sample changer collection is whats shown in the figure, Ill make a note on that.

One can imagine that for instance a plate sample changer where one have two levels of samples plate and crystal, I'm not saying that thats how it should be done but its a possibility. For workflows nested groups could make sense and even for multi sweep collections.

@rhfogh
Copy link
Collaborator

rhfogh commented Mar 22, 2024

OK, If you will put in something explicit about allowing nested groups, I'll remove my 'Request Changes' immediately and leave the rest to you. I made the point because (until I modified it) there was code assuming that the Sample was always two levels up from the DataCollection.

I still need to check with Olof exactly what the rules and assumptions about grouping are for MASSIF-1 operation.

Copy link
Collaborator

@rhfogh rhfogh left a comment

Choose a reason for hiding this comment

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

Approved, given that there will be some wording on the fact that e.g. nested DataCollectionGroups are allowed.

@marcus-oscarsson
Copy link
Member Author

I'm not sure how to approach this because I make some changes and push mostly to see how it renders, but then I get comments on certain things that are still in progress. As its draft Ill try to answer your general questions regarding the queue like the one @rhfogh asked, and the rest is still very much subject to change.

@rhfogh
Copy link
Collaborator

rhfogh commented Mar 22, 2024

You could mark it as WIP, if you prefer that we wait with the comments.

@axelboc
Copy link

axelboc commented Mar 22, 2024

We just got mixed up on what "Draft" means. Marcus opened this to show progress and to preview his work, not to request a review. As discussed during the meeting this morning, "Draft" means that it's not yet ready for review (unless the opener specifically asks for feedback). The removal of "Draft" status by the opener means that reviews are welcome.

@marcus-oscarsson
Copy link
Member Author

marcus-oscarsson commented Mar 22, 2024

I happy for the broader questions like the one @rhfogh asked or general questions about the queue that you'd like to know about, it helps me to narrow down on some details. Just to avoid that we waste our time on things that will most likely change. I also mark it as WIP ;)

@marcus-oscarsson marcus-oscarsson changed the title [Documentation Code Camp] - Added introductory section for queue documentation [WIP][Documentation Code Camp] - Added introductory section for queue documentation Mar 22, 2024
@marcus-oscarsson marcus-oscarsson force-pushed the mo-march-queue-doc branch 3 times, most recently from af8affc to b52f521 Compare March 22, 2024 15:02
@marcus-oscarsson marcus-oscarsson force-pushed the mo-march-queue-doc branch 2 times, most recently from 674a9df to fb2bba8 Compare April 16, 2024 10:20
@marcus-oscarsson marcus-oscarsson changed the title [WIP][Documentation Code Camp] - Added introductory section for queue documentation [Documentation Code Camp] - Added introductory section for queue documentation Apr 16, 2024
@marcus-oscarsson marcus-oscarsson changed the title [Documentation Code Camp] - Added introductory section for queue documentation [Documentation Code Camp] - Added introductory section for queue documentation - Part 1 Apr 16, 2024
@marcus-oscarsson marcus-oscarsson marked this pull request as ready for review April 16, 2024 10:22
@marcus-oscarsson
Copy link
Member Author

I believe this is starting to get usable, its not complete yet I will add a few sections in a near future. I plan on adding more on how the execution works and then Ill add something about the new queue design and the drawbacks of the current design. However, thats for Part 2 :)

@beteva
Copy link
Member

beteva commented Apr 16, 2024

Nice with diagrams.

```

**_NOTE:_** There are no constraints on the structure of the tree. However, today: the top level always contains sample nodes,
and the nesting occurs at the group level. The depth of nesting is currently maximum 3 - Sample -
Copy link
Collaborator

Choose a reason for hiding this comment

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

That is not actually the case for GPhL workflow - we nest more deeply. Maybe we should change that. This probably needs discussion, to make sure that everybody either is or is not ready for deeper nesting.

Copy link
Member Author

@marcus-oscarsson marcus-oscarsson Apr 16, 2024

Choose a reason for hiding this comment

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

That's not an issue, If you know how many levels you nest Ill update with that figure or phrase it like "the most common nesting depth is 3" or similar

Copy link
Member Author

Choose a reason for hiding this comment

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

So, I added a "disclaimer" for workflows, but let me know if you rather that we add a figure.

group_entry.enqueue(dc_entry)
```

Each type of data collection protocol has a piece of code similar to the code above associated with it. In the Web version, this is done in mxcubeweb.components.queue.py in the methods called add_**task_type**, for instance `add_data_collection`. In the Qt version, the creation is done in two different places: first in the widget where the queue model object is created, and then through `QueueModel.view_created`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should say explicitly that in the Qt version enqueueing the queue entry is done automatically when the qmo is added to the queue, via the QueueModel.add_child function, which sends out a child_added signal. It seems - to a very quick look - that the same is the case in the web version, via the function components.queue.Queue.queue_model_child_added. Maybe this should have a more prominent place in thedocumentation. Actually, is it the rule or an exception when enqueue is called explicitly rather than via signal?

Copy link
Member Author

Choose a reason for hiding this comment

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

Its not entirely correct for the web version because its only the case for collections added through workflows that use the signal, the rest is done through enqueue. Ill see what I can do

Copy link
Member Author

@marcus-oscarsson marcus-oscarsson Apr 16, 2024

Choose a reason for hiding this comment

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

Thanks, I tried to make clarify a bit, let me know what you think ?

Copy link
Collaborator

@rhfogh rhfogh left a comment

Choose a reason for hiding this comment

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

Very nice, but I think a couple of things for a quick discussion

@marcus-oscarsson marcus-oscarsson force-pushed the mo-march-queue-doc branch 2 times, most recently from 6e164c6 to 9f9a17c Compare April 16, 2024 14:56
@marcus-oscarsson marcus-oscarsson merged commit b8d4bc6 into develop Apr 26, 2024
2 of 3 checks passed
@marcus-oscarsson marcus-oscarsson deleted the mo-march-queue-doc branch April 26, 2024 11:45
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.

6 participants