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

Uploading while printing #357

Closed
Salandora opened this issue Jan 24, 2014 · 5 comments
Closed

Uploading while printing #357

Salandora opened this issue Jan 24, 2014 · 5 comments

Comments

@Salandora
Copy link
Contributor

Hello,

I'm using the devel branch, and encountered the following problem.
When uploading a gcode file while octoprint is printing, it stops streaming the commands to the printer so that the printer stops moving. After a couple of seconds everything runs as usual.

@foosel
Copy link
Member

foosel commented Jan 24, 2014

Is this on a raspberry pi? Because it might just be a bit too much to
handle for the little guy. File upload is rather io intense, as is
printing, so you might just be hitting the limit of what is possible there.

@Salandora
Copy link
Contributor Author

It's on an Olimex Olinuxino A20, but might be because of the IO processing, i will try to investigate it when I have some time left.

@Salandora
Copy link
Contributor Author

Hello,

I guess I found the problem, it's because of the gcode interpreter, the analysis is running as a thread, this thread seems to slow down other operations. As I know python has no option to priorise a thread.

Any Ideas how to solve the problem?
Because for me it's the first time using python, i don't know of the posibillities.

Is it an option to make the analysis an own program and just parsing the metadata in octoprint?

I hope my english is readable, I haven't used it for nearly 5 years now...

@Salandora
Copy link
Contributor Author

I investigated the problem further and found the problem:

While printing the analysis of gcode files should have been paused.
This isn*t working correctly.

In gcodefiles.py there is a "def work(self)" function in there is the problem:

while True:
    self._active.wait()

    if aborted is not None:
        filename = aborted
        aborted = None
        self._logger.debug("Got an aborted analysis job for file %s, processing this instead of first item in queue" % filename)
    else:
        (priority, filename) = self._queue.get()
        self._logger.debug("Processing file %s from queue (priority %d)" % (filename, priority))

needs to be changed into:

while True:

    if aborted is not None:
        filename = aborted
        aborted = None
        self._logger.debug("Got an aborted analysis job for file %s, processing this instead of first item in queue" % filename)
    else:
        (priority, filename) = self._queue.get()
        self._logger.debug("Processing file %s from queue (priority %d)" % (filename, priority))

    self._active.wait()

Explaination:
"(priority, filename) = self._queue.get()"
is blocking the whole function until it has an item in the queue.
So if you start printing the "self._active.wait()" has already been passed and the queue is blocking,
if you upload a file it gets analysed no matter if the analysis is paused or not.

@foosel
Copy link
Member

foosel commented Jan 27, 2014

Thanks for spotting this. I was wondering why gcode analysis might be to blame here, since it's -- as you pointed out -- actually supposed to be paused while printing. Didn't yet come around to take a closer look though (busy on another branch), so thanks for doing that for me :)

foosel added a commit that referenced this issue Feb 15, 2014
Evaluate active flag on gcode analyzer AFTER fetching an item from the work queue, otherwise it will always start working once it finds something if the active flag was true once but then switched to false while the queue was still empty.

Thanks to @Salandora for spotting this.

Fixes #357
@foosel foosel closed this as completed Feb 15, 2014
foosel added a commit that referenced this issue Feb 24, 2014
Evaluate active flag on gcode analyzer AFTER fetching an item from the work queue, otherwise it will always start working once it finds something if the active flag was true once but then switched to false while the queue was still empty.  Thanks to @Salandora for spotting this.

Fixes #357

(manually cherry-picked from 592f3dc)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants