def cancel_job_button(self, description=None):
if not hasattr(self, '<STR_LIT>'):<EOL><INDENT>return<EOL><DEDENT>try:<EOL><INDENT>import ipywidgets as widgets<EOL>if not description:<EOL><INDENT>description = '<STR_LIT>'<EOL>description += self.name if hasattr(self, '<STR_LIT:name>') else self.job.name<EOL><DEDENT>button = widgets.Button(description=description,<EOL>button_style='<STR_LIT>',<EOL>layout=widgets.Layout(width='<STR_LIT>'))<EOL>out = widgets.Output()<EOL>vb = widgets.VBox([button, out])<EOL>@out.capture(clear_output=True)<EOL>def _cancel_job_click(b):<EOL><INDENT>b.disabled=True<EOL>print('<STR_LIT>' + str(self.job.id) + '<STR_LIT>', flush=True)<EOL>try:<EOL><INDENT>rc = self.job.cancel()<EOL>out.clear_output()<EOL>if rc:<EOL><INDENT>print('<STR_LIT>' + str(self.job.id) + '<STR_LIT>' + self.job.name + '<STR_LIT:\n>', flush=True)<EOL><DEDENT>else:<EOL><INDENT>print('<STR_LIT>' + str(self.job.id) + '<STR_LIT>' + self.job.name + '<STR_LIT:\n>', flush=True)<EOL><DEDENT><DEDENT>except:<EOL><INDENT>b.disabled=False<EOL>out.clear_output()<EOL>raise<EOL><DEDENT><DEDENT>button.on_click(_cancel_job_click)<EOL>display(vb)<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT>
Display a button that will cancel the submitted job.

        Used in a Jupyter IPython notebook to provide an interactive
        mechanism to cancel a job submitted from the notebook.

        Once clicked the button is disabled unless the cancel fails.

        A job may be cancelled directly using::

            submission_result = submit(ctx_type, topology, config)
            submission_result.job.cancel()

        Args:

            description(str): Text used as the button description, defaults to value based upon the job name.

        .. warning::
            Behavior when called outside a notebook is undefined.

        .. versionadded:: 1.12