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

Action command which accept execution failure #54

Closed
vlcinsky opened this issue May 26, 2015 · 1 comment
Closed

Action command which accept execution failure #54

vlcinsky opened this issue May 26, 2015 · 1 comment

Comments

@vlcinsky
Copy link
Contributor

In make, one can prepend "-" to mark a command which is allowed to fail and will not break the whole task execution.

E.g. following (modified) snippet from Makefile for building PDF documentation tries few times command pdflatex (and all must succeed), then it tries command makeindex, which is allowed to fail without breaking whole task execution, and finally gives few more executions of pdflatex.

%.pdf: %.tex
    pdflatex '$<'
    pdflatex '$<'
    pdflatex '$<'
    -makeindex -s python.ist '$(basename $<).idx'
    pdflatex '$<'
    pdflatex '$<'

Question: is such an option available in doit?

@vlcinsky
Copy link
Contributor Author

@schettino72 Sorry for still adding content here, but my attempt to add this as a message to the discussion group seems to have no effect so far (I added it over web interface while being signed in and being marked as a member).

Some ideas and proposals for case it is not possible (yet):

def task_shaker():
    """Does something, survives particular failures"""
    return
    {
        "actions": [
            # simply prefix "-" to the command string
            "-makeindex -s python.ist data.idx",
            # "-" first item for cmd arg list
            ["-", "makeindex", "-s", "python.ist", "data.idx"],
            # CmdAction arg fail_safe=True
            CmdAction("makeindex -s python.ist data.idx", fail_safe=True),
            # "-" prefix recognized even in CmdAction
            CmdAction("-makeindex -s python.ist data.idx", cwd=subdir),
            # CmdFailSafe wrapps cmd-action failure, always pretends success
            CmdFailSafe("makeindex -s python.ist data.idx", cwd=subdir),
            # failsafe wrapps python-actions, always pretends success
            failsafe(makeindex, args, kwargs),
            # minus prefix in cmd-action tupple variant
            ("-", "makeindex -s python.ist data.idx"),
            # minus in terms "next one to fail safe"
            "-",
            "makeindex -s python.ist data.idx",
            # the same, just written on one line
            "-", "makeindex -s python.ist data.idx",
            # minus as "next one to fail safe" works for python-action too
            "-", (makeindex, args, kwargs),
        ]
    }

My preference (from dodo.py author point of view) would be whatever uses the "-".

  • Last two would suffice
  • Any other "-" related ones two would be easy to understand.
  • Adding too many other options could be counter productive but could be done if there are good reasons for that.

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

No branches or pull requests

2 participants