id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
142,366
from rocketry.conds import running def do_if_runs_between(): ... # Starts if do_things is running # less than 2 mins but no more than 5 minutes
null
142,367
from rocketry.conds import time_of_minute, time_of_hour, time_of_day, time_of_week def do_constantly_minute_before(): ...
null
142,368
from rocketry.conds import time_of_minute, time_of_hour, time_of_day, time_of_week def do_constantly_hour_after(): ...
null
142,369
from rocketry.conds import time_of_minute, time_of_hour, time_of_day, time_of_week def do_constantly_day_between(): ...
null
142,370
from rocketry.conds import time_of_minute, time_of_hour, time_of_day, time_of_week def do_constantly_week_on(): ...
null
142,371
from rocketry.conds import every def do_constantly(): ...
null
142,372
from rocketry.conds import every def do_minutely(): ...
null
142,373
from rocketry.conds import every def do_hourly(): ...
null
142,374
from rocketry.conds import every def do_daily(): ...
null
142,375
from rocketry.conds import every def do_custom(): ...
null
142,376
from rocketry.conds import after_all_success, after_any_success, after_any_finish, after_any_fail def do_a(): ...
null
142,377
from rocketry.conds import after_all_success, after_any_success, after_any_finish, after_any_fail def do_b(): ...
null
142,378
from rocketry.conds import after_all_success, after_any_success, after_any_finish, after_any_fail def do_all_succeeded(): ...
null
142,379
from rocketry.conds import after_all_success, after_any_success, after_any_finish, after_any_fail def do_any_succeeded(): ...
null
142,380
from rocketry.conds import after_all_success, after_any_success, after_any_finish, after_any_fail def do_any_failed(): ...
null
142,381
from rocketry.conds import after_all_success, after_any_success, after_any_finish, after_any_fail def do_any_failed_or_succeeded(): ...
null
142,382
from rocketry.conds import after_success, after_fail, after_finish def do_things(): ...
null
142,383
from rocketry.conds import after_success, after_fail, after_finish def do_after_success(): ...
null
142,384
from rocketry.conds import after_success, after_fail, after_finish def do_after_fail(): ...
null
142,385
from rocketry.conds import after_success, after_fail, after_finish def do_after_fail_or_success(): ...
null
142,386
def do_minutely(): ...
null
142,387
def do_hourly(): ...
null
142,388
def do_daily(): ...
null
142,389
def do_weekly(): ...
null
142,390
def do_monthly(): ...
null
142,396
from rocketry.args import Return def do_first(): return 'Hello World'
null
142,397
from rocketry.args import Return def do_second(arg=Return('do_first')): # arg's value is "Hello World" ...
null
142,398
def do_constantly(): ...
null
142,401
def do_after(): ...
null
142,402
def do_logic(): ...
null
142,404
def do_never(): ...
null
142,405
def do_and(): ...
null
142,406
def do_or(): ...
null
142,407
def do_not(): ...
null
142,408
def do_nested(): ...
null
142,409
def do_constantly_minute_before(): ...
null
142,410
def do_constantly_hour_after(): ...
null
142,411
def do_constantly_day_between(): ...
null
142,412
def do_constantly_week_on(): ...
null
142,417
def do_custom(): ...
null
142,418
def do_a(): ...
null
142,419
def do_b(): ...
null
142,420
def do_all_succeeded(): ...
null
142,421
def do_any_succeeded(): ...
null
142,422
def do_any_failed(): ...
null
142,423
def do_any_failed_or_succeeded(): ...
null
142,424
def do_things(): ...
null
142,425
def do_after_success(): ...
null
142,426
def do_after_success_2(): ...
null
142,427
def do_after_fail(): ...
null
142,428
def do_after_fail_or_success(): ...
null
142,429
from rocketry import Rocketry from rocketry.args import Return The provided code snippet includes necessary dependencies for implementing the `do_daily` function. Write a Python function `def do_daily()` to solve the following problem: This function runs once a day Here is the function: def do_daily(): "This fun...
This function runs once a day
142,430
from rocketry import Rocketry from rocketry.args import Return The provided code snippet includes necessary dependencies for implementing the `do_twice_a_day` function. Write a Python function `def do_twice_a_day()` to solve the following problem: This function runs twice a day (in the morning and in the afternoon) H...
This function runs twice a day (in the morning and in the afternoon)
142,431
from rocketry import Rocketry from rocketry.args import Return The provided code snippet includes necessary dependencies for implementing the `do_after_another` function. Write a Python function `def do_after_another(arg=Return('do_daily'))` to solve the following problem: Run after 'do_daily' task Here is the functi...
Run after 'do_daily' task
142,433
import asyncio from rocketry import Rocketry async def do_things(): ...
null
142,436
from redmail import EmailSender from rocketry import Rocketry email = EmailSender( host="smtp.myserver.com", port=584, username="me@example.com", password="<PASSWORD>" ) def measure_performance(receivers): email.send( subject="Wake up", )
null
142,437
from redmail import EmailSender from rocketry import Rocketry email = EmailSender( host="smtp.myserver.com", port=584, username="me@example.com", password="<PASSWORD>" ) def eat_lunch(receivers): email.send( subject="Go to eat", )
null
142,438
from redmail import EmailSender from rocketry import Rocketry email = EmailSender( host="smtp.myserver.com", port=584, username="me@example.com", password="<PASSWORD>" ) def go_to_sleep(receivers): email.send( subject="Go to eat", )
null
142,439
from typing import List, Literal, Optional from redbird.oper import in_, between from fastapi import APIRouter, FastAPI, Query from scheduler import app as app_rocketry session = app_rocketry.session async def get_session_config(): return session.config
null
142,440
from typing import List, Literal, Optional from redbird.oper import in_, between from fastapi import APIRouter, FastAPI, Query from scheduler import app as app_rocketry session = app_rocketry.session async def patch_session_config(values:dict): for key, val in values.items(): setattr(session.config, key, v...
null
142,441
from typing import List, Literal, Optional from redbird.oper import in_, between from fastapi import APIRouter, FastAPI, Query from scheduler import app as app_rocketry session = app_rocketry.session async def get_session_parameters(): return session.parameters
null
142,442
from typing import List, Literal, Optional from redbird.oper import in_, between from fastapi import APIRouter, FastAPI, Query from scheduler import app as app_rocketry session = app_rocketry.session async def get_session_parameters(name): return session.parameters[name]
null
142,443
from typing import List, Literal, Optional from redbird.oper import in_, between from fastapi import APIRouter, FastAPI, Query from scheduler import app as app_rocketry session = app_rocketry.session async def put_session_parameter(name:str, value): session.parameters[name] = value
null
142,444
from typing import List, Literal, Optional from redbird.oper import in_, between from fastapi import APIRouter, FastAPI, Query from scheduler import app as app_rocketry session = app_rocketry.session async def delete_session_parameter(name:str): del session.parameters[name]
null
142,445
from typing import List, Literal, Optional from redbird.oper import in_, between from fastapi import APIRouter, FastAPI, Query from scheduler import app as app_rocketry session = app_rocketry.session async def shut_down_session(): session.shut_down()
null
142,446
from typing import List, Literal, Optional from redbird.oper import in_, between from fastapi import APIRouter, FastAPI, Query from scheduler import app as app_rocketry session = app_rocketry.session async def get_tasks(): return list(session.tasks)
null
142,447
from typing import List, Literal, Optional from redbird.oper import in_, between from fastapi import APIRouter, FastAPI, Query from scheduler import app as app_rocketry session = app_rocketry.session async def get_task(task_name:str): return session[task_name]
null
142,448
from typing import List, Literal, Optional from redbird.oper import in_, between from fastapi import APIRouter, FastAPI, Query from scheduler import app as app_rocketry session = app_rocketry.session async def patch_task(task_name:str, values:dict): task = session[task_name] for attr, val in values.items(): ...
null
142,449
from typing import List, Literal, Optional from redbird.oper import in_, between from fastapi import APIRouter, FastAPI, Query from scheduler import app as app_rocketry session = app_rocketry.session async def disable_task(task_name:str): task = session[task_name] task.disabled = True
null
142,450
from typing import List, Literal, Optional from redbird.oper import in_, between from fastapi import APIRouter, FastAPI, Query from scheduler import app as app_rocketry session = app_rocketry.session async def run_task(task_name:str): task = session[task_name] task.run()
null
142,451
from typing import List, Literal, Optional from redbird.oper import in_, between from fastapi import APIRouter, FastAPI, Query from scheduler import app as app_rocketry session = app_rocketry.session async def get_task_logs(action: Optional[List[Literal['run', 'success', 'fail', 'terminate', 'crash', 'inaction']]] = Q...
null
142,452
from typing import List, Literal, Optional from redbird.oper import in_, between from fastapi import APIRouter, FastAPI, Query from scheduler import app as app_rocketry session = app_rocketry.session async def get_task_logs(task_name:str, action: Optional[List[Literal['run', 'success', 'fail', ...
null
142,453
from rocketry import Rocketry async def do_things(): ...
null
142,454
from rocketry import Rocketry async def do_stuff(): ...
null
142,455
from rocketry import Rocketry from rocketry.args import Return, Session, Arg, FuncArg from rocketry.conds import daily, time_of_week, after_success The provided code snippet includes necessary dependencies for implementing the `is_foo` function. Write a Python function `def is_foo()` to solve the following problem: Th...
This is a custom condition
142,456
from rocketry import Rocketry from rocketry.args import Return, Session, Arg, FuncArg from rocketry.conds import daily, time_of_week, after_success The provided code snippet includes necessary dependencies for implementing the `do_complex` function. Write a Python function `def do_complex()` to solve the following pro...
This task runs on complex interval and on separate process
142,457
from rocketry import Rocketry from rocketry.args import Return, Session, Arg, FuncArg from rocketry.conds import daily, time_of_week, after_success def do_daily(): "This task runs once a day when foo is true" ... return ... execution="process") The provided code snippet includes necessary depende...
This task runs after 'do_daily' and it has its the return argument as an input
142,458
from rocketry import Rocketry from rocketry.args import Return, Session, Arg, FuncArg from rocketry.conds import daily, time_of_week, after_success The provided code snippet includes necessary dependencies for implementing the `do_with_params` function. Write a Python function `def do_with_params(arg1=FuncArg(lambda: ...
This task runs with variety of arguments
142,459
from rocketry import Rocketry from rocketry.args import Return, Session, Arg, FuncArg from rocketry.conds import daily, time_of_week, after_success The provided code snippet includes necessary dependencies for implementing the `do_on_session` function. Write a Python function `def do_on_session(session=Session())` to ...
This task modifies the scheduling session
142,460
from rocketry import Rocketry from rocketry.args import Return, Arg def is_foo(): # This is a custom condition ... return True
null
142,461
from rocketry import Rocketry from rocketry.args import Return, Arg def get_item(): # This is a custom condition ... return 'world'
null
142,462
from rocketry import Rocketry from rocketry.args import Return, Arg The provided code snippet includes necessary dependencies for implementing the `do_on_process` function. Write a Python function `def do_on_process()` to solve the following problem: This task runs once a day and runs on separate process Here is the ...
This task runs once a day and runs on separate process
142,463
from rocketry import Rocketry from rocketry.args import Return, Arg The provided code snippet includes necessary dependencies for implementing the `do_pipeline` function. Write a Python function `def do_pipeline(arg1=Return('do_on_process'), arg2=Arg('item'), arg3=Arg('my_arg'))` to sol...
This task runs when 'do_on_process' has succeeded. Argument 'arg1' gets the return value of 'do_on_process' Argument 'arg2' gets the return value of function 'get_item' Argument 'arg3' is simply the value of a session parameter 'my_arg
142,464
from rocketry import Rocketry from rocketry.args import Return, Arg The provided code snippet includes necessary dependencies for implementing the `do_custom` function. Write a Python function `def do_custom()` to solve the following problem: This task runs once a day and when is_foo returns True This task runs on sep...
This task runs once a day and when is_foo returns True This task runs on separate thread
142,465
from rocketry import Rocketry from rocketry.args import Return, Arg The provided code snippet includes necessary dependencies for implementing the `do_complex` function. Write a Python function `def do_complex()` to solve the following problem: Notice the logical expression in the task start condition Here is the fun...
Notice the logical expression in the task start condition
142,467
from rocketry import Rocketry from rocketry.conds import daily def do_things(): ...
null
142,468
from rocketry.args import Return def do_first(): return 'Hello World' def do_second(arg=Return(do_first)): # arg's value is "Hello World" ...
null
142,469
import datetime from typing import Union from dateutil.parser import parse def datetime_to_dict(dt): return { "year": dt.year, "month": dt.month, "day": dt.day, "hour": dt.hour, "minute": dt.minute, "second": dt.second, "microsecond": dt.microsecond, ...
null
142,470
import datetime from typing import Union from dateutil.parser import parse def to_timestamp(dt) -> float: if hasattr(dt, "to_pydatetime"): dt = dt.to_pydatetime() return dt.timestamp()
null
142,471
import datetime from typing import Union from dateutil.parser import parse def string_to_datetime(s): return parse(s) def to_datetime(s, timezone=None): if isinstance(s, datetime.datetime): dt = s elif isinstance(s, str): dt = string_to_datetime(s) elif isinstance(s, (int, float)): ...
null
142,472
import datetime from typing import Union from dateutil.parser import parse def numb_to_timedelta(n: Union[float, int], unit="μs"): if unit == "ns": unit = 'μs' n /= 1000 units = ABBREVIATIONS[unit] + "s" return datetime.timedelta(**{units: n}) def string_to_timedelta(s:str): "Convert str...
Convert object to timedelta
142,473
import datetime from typing import Union from dateutil.parser import parse def timedelta_to_dict(dt, days_in_year=365, days_in_month=30, units=None): total_seconds = dt.total_seconds() microsec_in_day = 8.64e+10 microsec_in_hour = 3.6e+9 microsec_in_min = 6e+7 microsec_in_sec = 1e+6 microsec = t...
null
142,474
from pathlib import Path from typing import Union The provided code snippet includes necessary dependencies for implementing the `find_package_root` function. Write a Python function `def find_package_root(path) -> Union[Path, None]` to solve the following problem: Find package root from the path's parents. In other w...
Find package root from the path's parents. In other words, find first dir that don't contain __init__.py
142,475
import logging import os import sys import threading import warnings from typing import Any, Callable, Optional, Union from rocketry.core.log.adapter import TaskAdapter from rocketry.core.task import Task as BaseTask from rocketry.core.parameters import BaseArgument, Parameters class FuncArg(BaseArgument): """An ar...
null
142,476
from ._time import parse_time_string from .utils import ParserPicker def _parse_time_string(s:str, **kwargs): time = parse_time_string(s, **kwargs) return time
null
142,477
from typing import Callable, Dict, Pattern, Union from rocketry.core.condition.base import BaseCondition from rocketry.session import Session from ..utils import ParserError, CondParser class Session(RedBase): """Collection of the scheduler objects. Parameters ---------- config : dict, optional ...
Add a parsing instruction to be used for parsing a string to condition. Parameters ---------- d : dict TODO
142,478
from typing import Callable, Dict, Pattern, Union from rocketry.core.condition.base import BaseCondition from rocketry.session import Session from ..utils import ParserError, CondParser class BaseCondition(RedBase): """A condition is a thing/occurence that should happen in order to something happen. Condi...
Parse one condition
142,479
from rocketry.conditions import Any, All, Not from ..utils.string_parser import InstructionParser from .condition_item import parse_condition_item def _flatten(*args, types, with_attr): comps = [] for arg in args: if isinstance(arg, types): comps += getattr(arg, with_attr) else: ...
null
142,480
from rocketry.conditions import Any, All, Not from ..utils.string_parser import InstructionParser from .condition_item import parse_condition_item def _flatten(*args, types, with_attr): comps = [] for arg in args: if isinstance(arg, types): comps += getattr(arg, with_attr) else: ...
null
142,481
from rocketry.conditions import Any, All, Not from ..utils.string_parser import InstructionParser from .condition_item import parse_condition_item def _parse_not(arg): if hasattr(arg, "__invert__"): return ~arg if isinstance(arg, Not): return ~arg return Not(arg)
null