pytaskq 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ @import "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap";:root{--bg-color:#f8fafc;--surface-color:#fff;--text-primary:#1e293b;--text-secondary:#64748b;--border-color:#e2e8f0;--accent-color:#6366f1;--accent-hover:#4f46e5;--success-color:#10b981;--warning-color:#f59e0b;--danger-color:#ef4444;--card-shadow:0 4px 6px -1px #0000000d, 0 2px 4px -2px #0000000d;--card-hover:0 10px 15px -3px #00000014, 0 4px 6px -4px #0000000d;--task-bg:#f1f5f9;--code-bg:#1e293b;--code-text:#f8fafc;--table-hover:#f8fafc;--status-success-bg:#ecfdf5;--status-success-text:#065f46;--status-success-border:#34d399;--status-failed-bg:#fef2f2;--status-failed-text:#991b1b;--status-failed-border:#f87171;--status-warning-bg:#fffbeb;--status-warning-text:#92400e;--status-warning-border:#fbbf24;--status-processing-bg:#eff6ff;--status-processing-text:#1e40af;--status-processing-border:#60a5fa;--status-pending-bg:#f5f3ff;--status-pending-text:#4c1d95;--status-pending-border:#a78bfa;--status-default-bg:#f8fafc;--status-default-text:#475569;--status-default-border:#e2e8f0;--focus-ring:#6366f159;--backdrop:#0f172a59;--stage-running:#eef2ff}[data-theme=dark]{--bg-color:#09090b;--surface-color:#18181b;--text-primary:#fafafa;--text-secondary:#a1a1aa;--border-color:#27272a;--accent-color:#818cf8;--accent-hover:#6366f1;--success-color:#34d399;--warning-color:#fbbf24;--danger-color:#f87171;--card-shadow:0 4px 6px -1px #0000004d, 0 2px 4px -2px #0000004d;--card-hover:0 10px 15px -3px #00000080, 0 4px 6px -4px #00000080;--task-bg:#27272a;--code-bg:#000;--code-text:#d4d4d8;--table-hover:#27272a;--status-success-bg:#10b98126;--status-success-text:#34d399;--status-success-border:#10b9814d;--status-failed-bg:#ef444426;--status-failed-text:#f87171;--status-failed-border:#ef44444d;--status-warning-bg:#f59e0b26;--status-warning-text:#fbbf24;--status-warning-border:#f59e0b4d;--status-processing-bg:#3b82f626;--status-processing-text:#60a5fa;--status-processing-border:#3b82f64d;--status-pending-bg:#8b5cf626;--status-pending-text:#a78bfa;--status-pending-border:#8b5cf64d;--status-default-bg:#27272a;--status-default-text:#a1a1aa;--status-default-border:#3f3f46;--focus-ring:#818cf873;--backdrop:#0000008c;--stage-running:#1e1b3a}*,:before,:after{box-sizing:border-box}body{background-color:var(--bg-color);color:var(--text-primary);-webkit-font-smoothing:antialiased;font-variant-numeric:tabular-nums;min-height:100vh;margin:0;font-family:Inter,system-ui,sans-serif;font-size:15px;line-height:1.5}#root{max-width:1240px;margin:0 auto;padding:1.25rem 1.5rem 4rem}@media (width<=640px){#root{padding:1rem 1rem 3rem}}code,pre,.task-id{font-family:ui-monospace,SF Mono,Menlo,Consolas,monospace}:focus-visible{outline:2px solid var(--accent-color);outline-offset:2px}.muted{color:var(--text-secondary)}.small{font-size:.82rem}h2{letter-spacing:-.01em;margin:0 0 .75rem;font-size:1.05rem}h3{color:var(--text-secondary);margin:1.25rem 0 .4rem;font-size:.85rem;font-weight:600}.topbar{justify-content:space-between;align-items:center;margin-bottom:1.25rem;display:flex}.brand{letter-spacing:-.02em;align-items:center;gap:.6rem;font-size:1.15rem;font-weight:700;display:flex}.topbar-right{align-items:center;gap:.75rem;display:flex}.conn{color:var(--text-secondary);align-items:center;gap:.4rem;font-size:.8rem;display:inline-flex}.conn .dot{background:var(--warning-color);border-radius:50%;width:8px;height:8px}.conn.live .dot{background:var(--success-color)}.lifecycle{background:var(--surface-color);border:1px solid var(--border-color);border-radius:14px;grid-template-columns:1fr auto 1.3fr auto 1fr auto 1.3fr;align-items:stretch;margin-bottom:1rem;padding:.5rem;display:grid}.stage{border-radius:10px;min-width:0;padding:.9rem 1rem}.stage-running{background:var(--stage-running)}.stage-name{color:var(--text-secondary);align-items:center;gap:.4rem;font-size:.82rem;font-weight:600;display:flex}.stage-count{letter-spacing:-.03em;margin:.15rem 0;font-size:2.1rem;font-weight:700;line-height:1.15}.stage-note{color:var(--text-secondary);font-size:.75rem}.flow-arrow{color:var(--border-color);align-self:center;width:20px}[data-theme=dark] .flow-arrow{color:#3f3f46}.stage-outcomes{gap:1.25rem;display:flex}.tone-text-success{color:var(--success-color)}.tone-text-danger{color:var(--danger-color)}.capacity{background:var(--border-color);border-radius:99px;height:4px;margin:.25rem 0 .35rem;overflow:hidden}.capacity>div{background:var(--accent-color);height:100%;transition:width .4s}.cap-warning>div{background:var(--warning-color)}.cap-danger>div{background:var(--danger-color)}.pulse{background:var(--border-color);border-radius:50%;width:8px;height:8px}.pulse.on{background:var(--accent-color);animation:1.6s ease-in-out infinite pulse}@keyframes pulse{0%,to{opacity:1}50%{opacity:.3}}@media (prefers-reduced-motion:reduce){.pulse.on{animation:none}.capacity>div{transition:none}}@media (width<=900px){.lifecycle{grid-template-columns:1fr 1fr;gap:.25rem}.flow-arrow{display:none}}.callout{border:1px dashed var(--status-warning-border);background:var(--status-warning-bg);color:var(--text-primary);border-radius:12px;align-items:flex-start;gap:.85rem;margin-bottom:1rem;padding:1rem 1.1rem;display:flex}.callout svg{color:var(--warning-color);flex-shrink:0;margin-top:2px}.callout p{margin:.35rem 0;font-size:.9rem}.callout pre{background:var(--code-bg);color:var(--code-text);border-radius:8px;margin:.4rem 0;padding:.55rem .8rem;font-size:.85rem;overflow-x:auto}.panel .callout{margin:0}.tabs{border-bottom:1px solid var(--border-color);gap:.25rem;margin-bottom:1rem;display:flex;overflow-x:auto}.tab{white-space:nowrap;color:var(--text-secondary);border-bottom:2px solid #0000;align-items:center;gap:.45rem;margin-bottom:-1px;padding:.7rem .9rem;font-size:.9rem;font-weight:600;text-decoration:none;display:inline-flex}.tab:hover{color:var(--text-primary)}.tab.active{color:var(--text-primary);border-bottom-color:var(--accent-color)}.count{background:var(--task-bg);color:var(--text-secondary);border-radius:99px;padding:.05rem .45rem;font-size:.72rem}.count-danger{background:var(--status-failed-bg);color:var(--status-failed-text)}.panel{background:var(--surface-color);border:1px solid var(--border-color);border-radius:12px;padding:1rem}.toolbar{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:.75rem;margin-bottom:.75rem;display:flex}.toolbar p{margin:0}.toolbar-right{flex-wrap:wrap;align-items:center;gap:.5rem;display:flex}.chips{flex-wrap:wrap;gap:.35rem;display:flex}.chip{font:inherit;cursor:pointer;border:1px solid var(--border-color);color:var(--text-secondary);background:0 0;border-radius:99px;padding:.3rem .75rem;font-size:.82rem;font-weight:500}.chip:hover{color:var(--text-primary)}.chip.active{background:var(--text-primary);color:var(--surface-color);border-color:var(--text-primary)}select,input{font:inherit;color:var(--text-primary);background:var(--surface-color);border:1px solid var(--border-color);border-radius:8px;padding:.45rem .65rem;font-size:.9rem}input:focus,select:focus{border-color:var(--accent-color);box-shadow:0 0 0 3px var(--focus-ring);outline:none}.lookup{border:1px solid var(--border-color);color:var(--text-secondary);border-radius:8px;align-items:center;gap:.4rem;padding-left:.6rem;display:flex}.lookup input{border:none;width:14rem;max-width:50vw;padding-left:0}.lookup input:focus{box-shadow:none}.lookup:focus-within{border-color:var(--accent-color);box-shadow:0 0 0 3px var(--focus-ring)}.empty{text-align:center;color:var(--text-secondary);padding:2.5rem 1rem}.table-wrap{overflow-x:auto}table{border-collapse:collapse;width:100%;font-size:.88rem}th{text-align:left;color:var(--text-secondary);border-bottom:1px solid var(--border-color);white-space:nowrap;padding:.55rem .75rem;font-size:.78rem;font-weight:600}td{border-bottom:1px solid var(--border-color);vertical-align:top;padding:.65rem .75rem}tbody tr:last-child td{border-bottom:none}.num{text-align:right}table.jobs tbody tr{cursor:pointer}table.jobs tbody tr:hover td,table.jobs tbody tr:focus td{background:var(--table-hover)}table.jobs tbody tr:focus{outline:none}.task-name{font-weight:600}.task-id{color:var(--text-secondary);font-size:.72rem}.args{color:var(--text-secondary);text-overflow:ellipsis;white-space:nowrap;max-width:22rem;font-family:ui-monospace,Menlo,Consolas,monospace;font-size:.8rem;overflow:hidden}.error-cell{color:var(--status-failed-text);word-break:break-word;max-width:28rem;font-size:.82rem}.row-actions{justify-content:flex-end;gap:.35rem;display:flex}.badge{white-space:nowrap;border:1px solid;border-radius:99px;padding:.12rem .55rem;font-size:.75rem;font-weight:600;display:inline-block}.tone-waiting{background:var(--status-pending-bg);color:var(--status-pending-text);border-color:var(--status-pending-border)}.tone-running{background:var(--status-processing-bg);color:var(--status-processing-text);border-color:var(--status-processing-border)}.tone-warning{background:var(--status-warning-bg);color:var(--status-warning-text);border-color:var(--status-warning-border)}.tone-success{background:var(--status-success-bg);color:var(--status-success-text);border-color:var(--status-success-border)}.tone-danger{background:var(--status-failed-bg);color:var(--status-failed-text);border-color:var(--status-failed-border)}.tone-muted{background:var(--status-default-bg);color:var(--status-default-text);border-color:var(--status-default-border)}.prio{color:var(--text-secondary);font-size:.78rem}.prio-high{color:var(--danger-color);font-weight:600}.prio-low{opacity:.75}.btn{font:inherit;cursor:pointer;border:1px solid #0000;border-radius:8px;justify-content:center;align-items:center;gap:.4rem;padding:.6rem 1.1rem;font-size:.92rem;font-weight:600;display:inline-flex}.btn:disabled{opacity:.55;cursor:not-allowed}.btn-sm{padding:.35rem .7rem;font-size:.8rem}.btn-primary{background:var(--accent-color);color:#fff}.btn-primary:hover:not(:disabled){background:var(--accent-hover)}.btn-secondary{background:var(--task-bg);color:var(--text-primary);border-color:var(--border-color)}.btn-secondary:hover{background:var(--border-color)}.btn-ghost{color:var(--text-secondary);border-color:var(--border-color);background:0 0}.btn-ghost:hover{color:var(--text-primary)}.btn-danger{background:var(--status-failed-bg);color:var(--status-failed-text);border-color:var(--status-failed-border)}.icon-btn{color:var(--text-secondary);cursor:pointer;background:0 0;border:none;border-radius:6px;padding:.25rem;display:inline-flex}.icon-btn:hover{color:var(--text-primary)}.link{font:inherit;color:var(--accent-color);cursor:pointer;background:0 0;border:none;padding:0;font-weight:600}.link:hover{text-decoration:underline}.run-grid{grid-template-columns:minmax(220px,1fr) 2fr;align-items:start;gap:1rem;display:grid}@media (width<=820px){.run-grid{grid-template-columns:1fr}}.task-list ul{flex-direction:column;gap:.25rem;margin:0;padding:0;list-style:none;display:flex}.task-pick{text-align:left;width:100%;font:inherit;cursor:pointer;color:var(--text-primary);background:0 0;border:1px solid #0000;border-radius:8px;flex-direction:column;gap:.15rem;padding:.55rem .65rem;display:flex}.task-pick:hover{background:var(--task-bg)}.task-pick.active{background:var(--task-bg);border-color:var(--accent-color)}.task-pick-name{align-items:center;gap:.4rem;font-size:.9rem;font-weight:600;display:flex}.task-pick-name svg{color:var(--text-secondary)}.task-pick-doc{color:var(--text-secondary);font-size:.78rem}.task-pick-cron{color:var(--text-secondary);align-items:center;gap:.3rem;font-size:.74rem;display:flex}.run-form{flex-direction:column;gap:.9rem;display:flex}.run-form h2{margin:0}.run-form>p{margin:-.5rem 0 0}.field{flex-direction:column;gap:.35rem;display:flex}.field>span{font-size:.85rem;font-weight:600}.field small{color:var(--text-secondary);font-weight:400}.req{color:var(--danger-color);margin-left:.15rem;font-style:normal}.segmented{border:1px solid var(--border-color);border-radius:8px;flex-wrap:wrap;width:fit-content;display:inline-flex;overflow:hidden}.segmented button{font:inherit;color:var(--text-secondary);cursor:pointer;background:0 0;border:none;padding:.4rem .8rem;font-size:.83rem}.segmented button+button{border-left:1px solid var(--border-color)}.segmented button.active{background:var(--accent-color);color:#fff}.advanced summary{cursor:pointer;color:var(--text-secondary);margin-bottom:.5rem;font-size:.85rem}.run-form .btn-primary{align-self:flex-start}.drawer-backdrop{background:var(--backdrop);z-index:20;justify-content:flex-end;display:flex;position:fixed;inset:0}.drawer{background:var(--surface-color);border-left:1px solid var(--border-color);width:min(520px,100%);height:100%;padding:1.25rem 1.4rem 2rem;animation:.18s ease-out slide-in;overflow-y:auto}@keyframes slide-in{0%{opacity:0;transform:translate(24px)}to{opacity:1;transform:none}}@media (prefers-reduced-motion:reduce){.drawer{animation:none}}.drawer-head{justify-content:space-between;align-items:flex-start;gap:1rem;display:flex}.drawer-head h2{margin:0 0 .2rem;font-size:1.2rem}.drawer-head code{color:var(--text-secondary);word-break:break-all;font-size:.75rem}.drawer-status{align-items:center;gap:.6rem;margin:1rem 0;font-size:.8rem;display:flex}.facts{grid-template-columns:max-content 1fr;gap:.4rem 1rem;margin:0;font-size:.87rem;display:grid}.facts dt{color:var(--text-secondary)}.facts dd{word-break:break-word;margin:0}.facts code{font-size:.78rem}.code{background:var(--code-bg);color:var(--code-text);white-space:pre-wrap;word-break:break-word;border-radius:8px;max-height:22rem;margin:0;padding:.75rem .9rem;font-size:.8rem;overflow-x:auto}.code-error{color:#fca5a5}.drawer-actions{gap:.5rem;margin-top:1.5rem;display:flex}.notice{border-radius:8px;margin-top:1rem;padding:.75rem;font-size:.88rem}.notice-error{background:var(--status-failed-bg);color:var(--status-failed-text)}.toasts{z-index:30;flex-direction:column;gap:.5rem;max-width:calc(100vw - 2rem);display:flex;position:fixed;bottom:1rem;right:1rem}.toast{background:var(--surface-color);border:1px solid var(--border-color);min-width:260px;box-shadow:var(--card-hover);border-radius:10px;justify-content:space-between;align-items:center;gap:.75rem;padding:.7rem .8rem .7rem 1rem;font-size:.88rem;display:flex}.toast-success{border-left:3px solid var(--success-color)}.toast-error{border-left:3px solid var(--danger-color)}.stage-note.split{flex-wrap:wrap;gap:.15rem .6rem;display:flex}.stage-note.split span{white-space:nowrap}.auth-page{flex-direction:column;min-height:calc(100vh - 6rem);display:flex}.auth-card{background:var(--surface-color);border:1px solid var(--border-color);border-radius:14px;width:min(420px,100%);margin:6vh auto 0;padding:1.75rem 1.75rem 1.5rem}.auth-card h1{letter-spacing:-.02em;margin:0 0 .35rem;font-size:1.45rem}.auth-card>p{margin:0 0 1.1rem}.auth-form{flex-direction:column;gap:.9rem;display:flex}.auth-form .btn-primary{margin-top:.25rem}.auth-form .field small.muted{font-size:.78rem;line-height:1.4}.code-input{letter-spacing:.06em;text-transform:uppercase;font-family:ui-monospace,Menlo,Consolas,monospace}.auth-foot{margin:1.1rem 0 0}.center{text-align:center;margin-top:20vh}.notice-info{background:var(--status-processing-bg);color:var(--status-processing-text);margin:0 0 1rem}.auth-card .notice{margin-top:0}.user-chip{font:inherit;border:1px solid var(--border-color);color:var(--text-primary);cursor:pointer;background:0 0;border-radius:99px;align-items:center;gap:.4rem;padding:.3rem .65rem;font-size:.82rem;font-weight:600;display:inline-flex}.user-chip:hover{background:var(--task-bg)}.user-chip svg{color:var(--text-secondary)}.user-chip .role{color:var(--text-secondary);font-weight:500}@media (width<=520px){.user-chip .role,.conn{display:none}}.settings{flex-direction:column;gap:1rem;display:flex}.settings-section h2{margin-bottom:.15rem}.settings-section h3{margin-top:1.1rem}.settings-head{justify-content:space-between;align-items:flex-start;gap:1rem;margin-bottom:.75rem;display:flex}.settings-head p{margin:0}.grid-3{grid-template-columns:repeat(3,minmax(0,1fr));gap:.75rem;display:grid}@media (width<=760px){.grid-3{grid-template-columns:1fr}}.inline-form{flex-direction:column;gap:.6rem;display:flex}.inline-form h3,.inline-form p{margin:0}.inline-row{flex-wrap:wrap;align-items:center;gap:.5rem;margin:.5rem 0 .75rem;display:flex}.inline-row input{flex:16rem;min-width:0}.token-reveal{border:1px solid var(--status-success-border);background:var(--status-success-bg);border-radius:10px;flex-direction:column;gap:.6rem;margin:.25rem 0 .75rem;padding:.85rem 1rem;display:flex}.token-reveal p{margin:0;font-size:.88rem}.token-reveal .btn-ghost{align-self:flex-start}.token-row{flex-wrap:wrap;align-items:center;gap:.5rem;display:flex}.token-row code{overflow-wrap:anywhere;background:var(--surface-color);border:1px solid var(--border-color);border-radius:6px;flex:18rem;min-width:0;padding:.45rem .6rem;font-size:.8rem}
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="48" height="46" fill="none" viewBox="0 0 48 46"><path fill="#863bff" d="M25.946 44.938c-.664.845-2.021.375-2.021-.698V33.937a2.26 2.26 0 0 0-2.262-2.262H10.287c-.92 0-1.456-1.04-.92-1.788l7.48-10.471c1.07-1.497 0-3.578-1.842-3.578H1.237c-.92 0-1.456-1.04-.92-1.788L10.013.474c.214-.297.556-.474.92-.474h28.894c.92 0 1.456 1.04.92 1.788l-7.48 10.471c-1.07 1.498 0 3.579 1.842 3.579h11.377c.943 0 1.473 1.088.89 1.83L25.947 44.94z" style="fill:#863bff;fill:color(display-p3 .5252 .23 1);fill-opacity:1"/><mask id="a" width="48" height="46" x="0" y="0" maskUnits="userSpaceOnUse" style="mask-type:alpha"><path fill="#000" d="M25.842 44.938c-.664.844-2.021.375-2.021-.698V33.937a2.26 2.26 0 0 0-2.262-2.262H10.183c-.92 0-1.456-1.04-.92-1.788l7.48-10.471c1.07-1.498 0-3.579-1.842-3.579H1.133c-.92 0-1.456-1.04-.92-1.787L9.91.473c.214-.297.556-.474.92-.474h28.894c.92 0 1.456 1.04.92 1.788l-7.48 10.471c-1.07 1.498 0 3.578 1.842 3.578h11.377c.943 0 1.473 1.088.89 1.832L25.843 44.94z" style="fill:#000;fill-opacity:1"/></mask><g mask="url(#a)"><g filter="url(#b)"><ellipse cx="5.508" cy="14.704" fill="#ede6ff" rx="5.508" ry="14.704" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -4.47 31.516)"/></g><g filter="url(#c)"><ellipse cx="10.399" cy="29.851" fill="#ede6ff" rx="10.399" ry="29.851" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -39.328 7.883)"/></g><g filter="url(#d)"><ellipse cx="5.508" cy="30.487" fill="#7e14ff" rx="5.508" ry="30.487" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.814 -25.913 -14.639)scale(1 -1)"/></g><g filter="url(#e)"><ellipse cx="5.508" cy="30.599" fill="#7e14ff" rx="5.508" ry="30.599" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.814 -32.644 -3.334)scale(1 -1)"/></g><g filter="url(#f)"><ellipse cx="5.508" cy="30.599" fill="#7e14ff" rx="5.508" ry="30.599" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -34.34 30.47)"/></g><g filter="url(#g)"><ellipse cx="14.072" cy="22.078" fill="#ede6ff" rx="14.072" ry="22.078" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="rotate(93.35 24.506 48.493)scale(-1 1)"/></g><g filter="url(#h)"><ellipse cx="3.47" cy="21.501" fill="#7e14ff" rx="3.47" ry="21.501" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.009 28.708 47.59)scale(-1 1)"/></g><g filter="url(#i)"><ellipse cx="3.47" cy="21.501" fill="#7e14ff" rx="3.47" ry="21.501" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.009 28.708 47.59)scale(-1 1)"/></g><g filter="url(#j)"><ellipse cx=".387" cy="8.972" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(39.51 .387 8.972)"/></g><g filter="url(#k)"><ellipse cx="47.523" cy="-6.092" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 47.523 -6.092)"/></g><g filter="url(#l)"><ellipse cx="41.412" cy="6.333" fill="#47bfff" rx="5.971" ry="9.665" style="fill:#47bfff;fill:color(display-p3 .2799 .748 1);fill-opacity:1" transform="rotate(37.892 41.412 6.333)"/></g><g filter="url(#m)"><ellipse cx="-1.879" cy="38.332" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 -1.88 38.332)"/></g><g filter="url(#n)"><ellipse cx="-1.879" cy="38.332" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 -1.88 38.332)"/></g><g filter="url(#o)"><ellipse cx="35.651" cy="29.907" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 35.651 29.907)"/></g><g filter="url(#p)"><ellipse cx="38.418" cy="32.4" fill="#47bfff" rx="5.971" ry="15.297" style="fill:#47bfff;fill:color(display-p3 .2799 .748 1);fill-opacity:1" transform="rotate(37.892 38.418 32.4)"/></g></g><defs><filter id="b" width="60.045" height="41.654" x="-19.77" y="16.149" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="c" width="90.34" height="51.437" x="-54.613" y="-7.533" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="d" width="79.355" height="29.4" x="-49.64" y="2.03" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="e" width="79.579" height="29.4" x="-45.045" y="20.029" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="f" width="79.579" height="29.4" x="-43.513" y="21.178" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="g" width="74.749" height="58.852" x="15.756" y="-17.901" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="h" width="61.377" height="25.362" x="23.548" y="2.284" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="i" width="61.377" height="25.362" x="23.548" y="2.284" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="j" width="56.045" height="63.649" x="-27.636" y="-22.853" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="k" width="54.814" height="64.646" x="20.116" y="-38.415" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="l" width="33.541" height="35.313" x="24.641" y="-11.323" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="m" width="54.814" height="64.646" x="-29.286" y="6.009" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="n" width="54.814" height="64.646" x="-29.286" y="6.009" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="o" width="54.814" height="64.646" x="8.244" y="-2.416" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="p" width="39.409" height="43.623" x="18.713" y="10.588" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter></defs></svg>
@@ -0,0 +1,15 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/static/favicon.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <meta name="description" content="PyTaskQ dashboard — watch, run and manage background jobs" />
8
+ <title>PyTaskQ Dashboard</title>
9
+ <script type="module" crossorigin src="/static/assets/index-Biu-vuAP.js"></script>
10
+ <link rel="stylesheet" crossorigin href="/static/assets/index-mgpfRVrS.css">
11
+ </head>
12
+ <body>
13
+ <div id="root"></div>
14
+ </body>
15
+ </html>
@@ -0,0 +1,144 @@
1
+ """
2
+ pytaskq.task_registery — built-in demo tasks
3
+ =============================================
4
+
5
+ These example tasks power the default dashboard demo and the Docker worker
6
+ (`pytaskq worker --app pytaskq.task_registery:queue`). Your own project should
7
+ create its own `PyTaskQ()` instance — see example_app.py.
8
+
9
+ Kept importable for backwards compatibility:
10
+ PyTaskQ, queue, TASKS, UnsafeURL, _assert_safe_url, _SafeRedirectHandler, _SAFE_OPENER
11
+ """
12
+
13
+ import csv
14
+ import io
15
+ import random
16
+ import time
17
+ import urllib.request
18
+ import uuid
19
+
20
+ from pytaskq.app import PyTaskQ, _deliver_webhook # noqa: F401 (re-exported)
21
+ from pytaskq.net import ( # noqa: F401 (re-exported for backwards compatibility)
22
+ SAFE_OPENER,
23
+ UnsafeURL,
24
+ assert_safe_url,
25
+ _assert_safe_url,
26
+ _SafeRedirectHandler,
27
+ _SAFE_OPENER,
28
+ )
29
+
30
+ # Global demo SDK instance
31
+ queue = PyTaskQ("demo")
32
+ # Alias for backward compatibility with older worker code
33
+ TASKS = queue.TASKS
34
+
35
+
36
+ @queue.task(type="cpu")
37
+ def matrix_multiply(size: int):
38
+ """Multiply two random N x N matrices (CPU-heavy, needs numpy)."""
39
+ import numpy as np
40
+ if not 1 <= size <= 1000:
41
+ raise ValueError("size must be between 1 and 1000")
42
+ A = np.random.rand(size, size)
43
+ B = np.random.rand(size, size)
44
+ result = np.dot(A, B)
45
+ # Return shape info only — returning a 1000x1000 float array as JSON
46
+ # would produce a ~8MB response and crash Redis serialization.
47
+ return f"Matrix multiplication complete: {size}x{size} result computed."
48
+
49
+
50
+ @queue.task(type="cpu")
51
+ def generate_csv_report(rows: int):
52
+ """Generate an in-memory CSV report with fake transactions."""
53
+ try:
54
+ start_time = time.time()
55
+
56
+ # 1. Create an in-memory string buffer
57
+ output = io.StringIO()
58
+
59
+ # 2. Create a CSV writer attached to the buffer
60
+ writer = csv.writer(output)
61
+
62
+ # 3. Write the header row
63
+ writer.writerow(["transaction_id", "user_id", "amount", "status"])
64
+
65
+ # 4. Generate the fake data
66
+ for _ in range(rows):
67
+ transaction_id = str(uuid.uuid4())
68
+ user_id = random.randint(1, 500)
69
+ amount = round(random.uniform(10.0, 1000.0), 2)
70
+ status = random.choice(["Success", "Failed", "Pending"])
71
+
72
+ writer.writerow([transaction_id, user_id, amount, status])
73
+
74
+ # 5. Get the full CSV string from the buffer
75
+ csv_string = output.getvalue()
76
+ output.close()
77
+
78
+ end_time = time.time()
79
+
80
+ return {
81
+ "status": "success",
82
+ "rows_generated": rows,
83
+ "bytes_size": len(csv_string),
84
+ "time_taken_ms": round((end_time - start_time) * 1000)
85
+ }
86
+
87
+ except Exception as e:
88
+ return {"status": "error", "error": str(e)}
89
+
90
+
91
+
92
+ @queue.task(type="cpu")
93
+ def resize_image(image_url: str, width: int, height: int):
94
+ """Download an image (SSRF-guarded, 10 MB cap) and resize it with Pillow."""
95
+ from PIL import Image
96
+ try:
97
+ start_time = time.time()
98
+
99
+ # 1. SSRF guard: reject URLs that resolve to private/internal addresses
100
+ assert_safe_url(image_url)
101
+
102
+ # 2. Download the image into memory (capped) instead of straight to disk
103
+ request = urllib.request.Request(image_url, headers={"User-Agent": "PyTaskQ-Worker/1.0"})
104
+ with SAFE_OPENER.open(request, timeout=10) as resp:
105
+ image_bytes = resp.read(10 * 1024 * 1024) # hard cap: 10 MB
106
+
107
+ # 3. Open, resize, and encode the image using Pillow
108
+ with Image.open(io.BytesIO(image_bytes)) as img:
109
+ # Convert to RGB in case it's a PNG with transparency
110
+ if img.mode in ("RGBA", "P"):
111
+ img = img.convert("RGB")
112
+
113
+ resized = img.resize((width, height))
114
+ buffer = io.BytesIO()
115
+ resized.save(buffer, format="JPEG", quality=85)
116
+
117
+ end_time = time.time()
118
+
119
+ return {
120
+ "status": "success",
121
+ "bytes_processed": len(image_bytes),
122
+ "original_url": image_url,
123
+ "dimensions": f"{width}x{height}",
124
+ "time_taken_ms": round((end_time - start_time) * 1000)
125
+ }
126
+
127
+ except Exception as e:
128
+ return {"status": "error", "error": str(e)}
129
+
130
+
131
+ @queue.task(type="io")
132
+ def url_health_check(url: str):
133
+ """Check that a public URL responds and measure its latency."""
134
+ try:
135
+ # SSRF guard: reject URLs that resolve to private/internal addresses
136
+ assert_safe_url(url)
137
+ time1=time.time()
138
+ resp = SAFE_OPENER.open(url, timeout=10)
139
+ resp.read(1024) # drain a little so the socket closes cleanly
140
+ time2 = time.time()
141
+ diff = time2-time1
142
+ return {"url": url, "status_code": resp.status, "response_time_ms": round(diff * 1000)}
143
+ except Exception as e :
144
+ return {"url": url, "status_code": 0, "error": str(e)}
pytaskq/tracing.py ADDED
@@ -0,0 +1,98 @@
1
+ """
2
+ src/tracing.py — Centralized OpenTelemetry setup for PyTaskQ
3
+ =============================================================
4
+
5
+ WHY THIS FILE EXISTS:
6
+ Both app.py (API) and worker.py (consumer) need to emit traces.
7
+ Instead of duplicating OTel setup code, they both call:
8
+ tracer = init_tracer("pytaskq-api") # or "pytaskq-worker"
9
+
10
+ HOW TRACES CROSS THE REDIS QUEUE:
11
+ Normal HTTP tracing works because libraries inject a `traceparent` header
12
+ automatically. But Redis LPUSH is just a raw string — there are no headers.
13
+
14
+ Our solution:
15
+ 1. app.py: inject_trace_context() → returns {"traceparent": "00-abc..."}
16
+ 2. We stuff that dict into the task JSON payload as `trace_carrier`
17
+ 3. worker.py: extract_trace_context(carrier) → reconstructs the parent span
18
+ 4. Worker creates a CHILD span linked to the same Trace ID
19
+
20
+ Result: Jaeger shows one continuous waterfall from API → Queue → Worker.
21
+ """
22
+
23
+ import os
24
+ from opentelemetry import trace
25
+ from opentelemetry.trace.propagation.tracecontext import TraceContextTextMapPropagator
26
+
27
+ # The W3C propagator knows how to serialize/deserialize trace context
28
+ # into a simple dict with a "traceparent" key.
29
+ _propagator = TraceContextTextMapPropagator()
30
+
31
+
32
+ def init_tracer(service_name: str) -> trace.Tracer:
33
+ """
34
+ Return a Tracer for this service ("pytaskq-api" or "pytaskq-worker").
35
+
36
+ Tracing is OPT-IN: nothing is exported unless OTEL_EXPORTER_OTLP_ENDPOINT
37
+ (or PYTASKQ_TRACING=1) is set. Without it, spans are no-ops, so a fresh
38
+ install doesn't spam "connection refused" errors when Jaeger isn't running.
39
+ """
40
+ endpoint = os.getenv("OTEL_EXPORTER_OTLP_ENDPOINT", "")
41
+ enabled = bool(endpoint) or os.getenv("PYTASKQ_TRACING", "").lower() in ("1", "true", "yes")
42
+ if not enabled:
43
+ return trace.get_tracer(service_name)
44
+
45
+ try:
46
+ from opentelemetry.sdk.trace import TracerProvider
47
+ from opentelemetry.sdk.trace.export import BatchSpanProcessor
48
+ from opentelemetry.sdk.resources import Resource
49
+ from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
50
+ except ImportError: # exporter not installed → keep no-op tracing
51
+ return trace.get_tracer(service_name)
52
+
53
+ # Resource = metadata that Jaeger attaches to every span from this process
54
+ resource = Resource.create({"service.name": service_name})
55
+ provider = TracerProvider(resource=resource)
56
+ # BatchSpanProcessor ships spans in a background thread — no request latency.
57
+ exporter = OTLPSpanExporter(endpoint=endpoint or "http://localhost:4317", insecure=True)
58
+ provider.add_span_processor(BatchSpanProcessor(exporter))
59
+ trace.set_tracer_provider(provider)
60
+
61
+ return trace.get_tracer(service_name)
62
+
63
+
64
+ def inject_trace_context() -> dict:
65
+ """
66
+ Serialize the CURRENT active span's context into a plain dict.
67
+
68
+ Called by app.py right after starting a span. The returned dict
69
+ looks like: {"traceparent": "00-<trace_id>-<span_id>-01"}
70
+
71
+ We store this dict in the task JSON payload so the worker can
72
+ reconstruct it later.
73
+
74
+ Think of it like writing your return address on a letter —
75
+ whoever receives it knows where the conversation started.
76
+ """
77
+ carrier: dict[str, str] = {}
78
+ _propagator.inject(carrier)
79
+ return carrier
80
+
81
+
82
+ def extract_trace_context(carrier: dict) -> trace.Context | None:
83
+ """
84
+ Deserialize a trace context dict back into an OTel Context object.
85
+
86
+ Called by worker.py when it picks up a task from Redis.
87
+ The returned Context is passed to tracer.start_as_current_span(context=...)
88
+ so the worker's span becomes a CHILD of the API's span.
89
+
90
+ If the carrier is empty (old tasks without tracing), returns None
91
+ and the worker just creates an independent trace.
92
+
93
+ Think of it like reading the return address off a letter —
94
+ now you can reply in the same conversation thread.
95
+ """
96
+ if not carrier:
97
+ return None
98
+ return _propagator.extract(carrier=carrier)