{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0d86469b",
   "metadata": {
    "lines_to_next_cell": 2,
    "tags": [
     "parameters"
    ]
   },
   "outputs": [],
   "source": [
    "SLEEP = 5\n",
    "ERROR = False\n",
    "\n",
    "NOW = None\n",
    "WFID = \"test_job\"\n",
    "EXECUTIONID = \"test_exec\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "97c59891-c8eb-4d5f-bb31-c4ce3c1cbc9a",
   "metadata": {
    "lines_to_next_cell": 2
   },
   "outputs": [],
   "source": [
    "import time\n",
    "# from nb_workflows.client.shortcuts import create_ctx\n",
    "\n",
    "# create_ctx()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b611d982",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "from datetime import datetime\n",
    "\n",
    "print(\"=\" * 10)\n",
    "print(f\"JOBID: {JOBID} starting\")\n",
    "print(f\"EXECUTIONID: {EXECUTIONID} starting\")\n",
    "print(\"=\" * 10)\n",
    "print(f\"SLEEP: {SLEEP}\")\n",
    "print(f\"ERROR: {ERROR}\")\n",
    "\n",
    "NOW = datetime.utcnow().isoformat()\n",
    "\n",
    "time.sleep(SLEEP)\n",
    "\n",
    "if ERROR:\n",
    "    raise IndexError(\"Error was requested for this task\")\n",
    "    # 10 / 0\n",
    "print(\"Error?\", ERROR)\n",
    "\n",
    "print(f\"Task {JOBID} finished\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
