id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
27,422 | from alembic import op
import sqlalchemy as sa
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('block_run', sa.Column('metrics', sa.JSON(), nullable=True))
# ### end Alembic commands ### | null |
27,423 | from alembic import op
import sqlalchemy as sa
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('block_run', 'metrics')
# ### end Alembic commands ### | null |
27,424 | from alembic import op
import sqlalchemy as sa
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('backfill',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('block_uuid', sa.String(length=255), nullable=True),
sa.Column... | null |
27,425 | from alembic import op
import sqlalchemy as sa
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('pipeline_run', schema=None) as batch_op:
batch_op.drop_constraint('pipeline_run_backfill_id', type_='foreignkey')
batch_op.drop_column... | null |
27,426 | from alembic import op
import sqlalchemy as sa
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('tag',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('(CURR... | null |
27,427 | from alembic import op
import sqlalchemy as sa
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('tag_association', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_tag_association_taggable_id'))
op.drop_table('tag_associat... | null |
27,428 | from alembic import op
import sqlalchemy as sa
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('oauth2_access_token', schema=None) as batch_op:
batch_op.create_index(batch_op.f('ix_oauth2_access_token_token'), ['token'], unique=True)
w... | null |
27,429 | from alembic import op
import sqlalchemy as sa
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('user', schema=None) as batch_op:
batch_op.drop_index(batch_op.f('ix_user_username'))
batch_op.drop_index(batch_op.f('ix_user_email'))
... | null |
27,430 | from alembic import op
import sqlalchemy as sa
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('role_permission',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa... | null |
27,431 | from alembic import op
import sqlalchemy as sa
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('role_permission')
# ### end Alembic commands ### | null |
27,432 | from alembic import op
import sqlalchemy as sa
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('role',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('(CUR... | null |
27,433 | from alembic import op
import sqlalchemy as sa
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('user_role')
op.drop_table('permission')
op.drop_table('role')
# ### end Alembic commands ### | null |
27,434 | from alembic import op
import sqlalchemy as sa
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
bind = op.get_bind()
if bind.engine.name == 'postgresql':
with op.get_context().autocommit_block():
op.execute("ALTER TYPE blockrunstatus ADD VALUE 'UPSTRE... | null |
27,435 | from alembic import op
import sqlalchemy as sa
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
bind = op.get_bind()
if bind.engine.name == 'postgresql':
op.execute("ALTER TYPE blockrunstatus RENAME TO blockrunstatus_old")
op.execute("CREATE TYPE blockr... | null |
27,436 | import logging
import os
import sys
from logging.config import fileConfig
from alembic import context
from sqlalchemy import engine_from_config, pool
config = context.config
if (
config.config_file_name is not None
and config.attributes.get('configure_logger', True)
):
fileConfig(config.config_file_name)
im... | Run migrations in 'offline' mode. This configures the context with just a URL and not an Engine, though an Engine is acceptable here as well. By skipping the Engine creation we don't even need a DBAPI to be available. Calls to context.execute() here emit the given string to the script output. |
27,437 | import logging
import os
import sys
from logging.config import fileConfig
from alembic import context
from sqlalchemy import engine_from_config, pool
config = context.config
if (
config.config_file_name is not None
and config.attributes.get('configure_logger', True)
):
fileConfig(config.config_file_name)
im... | Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context. |
27,438 | import multiprocessing
def start_session_and_run(*target_args, **kwargs):
from mage_ai.orchestration.db import db_connection
if len(target_args) == 0:
return None
target = target_args[0]
args = target_args[1:]
db_connection.start_session(force=True)
try:
results = target(*args)
... | null |
27,439 | from mage_ai.orchestration.db import db_connection, safe_db_query
from mage_ai.orchestration.db.models.schedules import (
Backfill,
PipelineRun,
PipelineSchedule,
)
db_connection = DBConnection()
class PipelineSchedule(PipelineScheduleProjectPlatformMixin, BaseModel):
name = Column(String(255))
de... | null |
27,440 | from datetime import datetime
from typing import Dict, Optional
from mage_ai.api.resources.PipelineScheduleResource import PipelineScheduleResource
from mage_ai.data_preparation.models.pipeline import Pipeline
from mage_ai.data_preparation.models.triggers import ScheduleStatus, ScheduleType
from mage_ai.orchestration.d... | null |
27,441 | import asyncio
import json
from datetime import datetime, timedelta, timezone
from logging import Logger
from time import sleep
from typing import Dict, List, Optional
from mage_ai.data_preparation.logging.logger import DictLogger
from mage_ai.data_preparation.models.global_data_product import GlobalDataProduct
from ma... | null |
27,442 | import os
import subprocess
from typing import Tuple
import psutil
def get_compute() -> Tuple[float, float, float, float]:
# Getting loadover15 minutes
load1, load5, load15 = psutil.getloadavg()
cpu_count = os.cpu_count()
return load1, load5, load15, cpu_count | null |
27,443 | import os
import subprocess
from typing import Tuple
import psutil
def get_memory() -> Tuple[float, float, float]:
free_memory = None
total_memory = None
used_memory = None
try:
output = subprocess.check_output('free -t -m', shell=True).decode('utf-8')
values = output.splitlines()[-1].... | null |
27,444 | import pandas as pd
def escape_quotes(line: str, single: bool = True, double: bool = True) -> str:
new_line = str(line)
if single:
new_line = new_line.replace("'", "''")
if double:
new_line = new_line.replace('\"', '\\"')
return new_line
def format_value(value):
if type(value) is no... | null |
27,445 | from enum import Enum
from typing import Callable, Dict, List, Mapping
from pandas import DataFrame, Series
from pandas.api.types import infer_dtype
from mage_ai.shared.utils import clean_name
The provided code snippet includes necessary dependencies for implementing the `infer_dtypes` function. Write a Python functio... | Fetches the internal pandas datatypes for the columns in the data frame. Args: df (DataFrame): Data frame to fetch dtypes from. Returns: Dict[str, str]: Map of column names to inferred dtypes |
27,446 | from enum import Enum
from typing import Callable, Dict, List, Mapping
from pandas import DataFrame, Series
from pandas.api.types import infer_dtype
from mage_ai.shared.utils import clean_name
The provided code snippet includes necessary dependencies for implementing the `clean_df_for_export` function. Write a Python ... | Cleans data frame with the appropriate steps to prepare loading the data frame to the target database. Args: df (DataFrame): Data frame to clean. column_mapper (Callable[[Series, str], str]): Function that cleans a column given the pandas data type. dtypes (Mapping[str, str]): Name of the new table to create Returns: s... |
27,447 | from enum import Enum
from typing import Callable, Dict, List, Mapping
from pandas import DataFrame, Series
from pandas.api.types import infer_dtype
from mage_ai.shared.utils import clean_name
def clean_name(
name,
allow_characters: List[str] = None,
allow_number: bool = False,
case_sensitive: bool = F... | Generates a database table creation query from a data frame. Args: dtypes (Mapping[str, str]): Database relative data types for each column of the data frame. schema_name (str): Name of schema to create new table in. table_name (str): Name of the new table to create. Returns: str: Table creation query for this table. |
27,448 | import json
import os
from typing import Dict
from google.api.launch_stage_pb2 import LaunchStage
from google.api_core.exceptions import AlreadyExists
from google.cloud import run_v2
from google.oauth2 import service_account
from google.protobuf.duration_pb2 import Duration
from mage_ai.server.logger import Logger
from... | null |
27,449 | import os
import socket
from enum import Enum
from typing import List
import requests
from mage_ai.services.aws.emr.constants import SECURITY_GROUP_NAME_MASTER_DEFAULT
from mage_ai.services.compute.aws.constants import (
CONNECTION_CREDENTIAL_AWS_ACCESS_KEY_ID,
CONNECTION_CREDENTIAL_AWS_SECRET_ACCESS_KEY,
)
fro... | null |
27,450 | import os
import socket
from enum import Enum
from typing import List
import requests
from mage_ai.services.aws.emr.constants import SECURITY_GROUP_NAME_MASTER_DEFAULT
from mage_ai.services.compute.aws.constants import (
CONNECTION_CREDENTIAL_AWS_ACCESS_KEY_ID,
CONNECTION_CREDENTIAL_AWS_SECRET_ACCESS_KEY,
)
fro... | null |
27,451 | import traceback
import redis
import redis
def init_redis_client(redis_url):
if not redis_url:
return None
try:
redis_client = redis.Redis.from_url(url=redis_url, decode_responses=True)
redis_client.ping()
except Exception:
traceback.print_exc()
redis_client = None
... | null |
27,452 | import json
import os
import socket
from typing import Dict
from sshtunnel import SSHTunnelForwarder
from mage_ai.data_preparation.models.project import Project
from mage_ai.services.compute.aws.models import Cluster
from mage_ai.services.compute.constants import SSH_PORT
from mage_ai.services.compute.models import Com... | null |
27,453 | import json
import os
import socket
from typing import Dict
from sshtunnel import SSHTunnelForwarder
from mage_ai.data_preparation.models.project import Project
from mage_ai.services.compute.aws.models import Cluster
from mage_ai.services.compute.constants import SSH_PORT
from mage_ai.services.compute.models import Com... | null |
27,454 | import os
import time
import traceback
from azure.identity import DefaultAzureCredential
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
from azure.mgmt.containerinstance.models import (
Container,
ContainerGroup,
ContainerGroupRestartPolicy,
ResourceRequests,
ResourceRequ... | null |
27,455 | import logging
from botocore.exceptions import ClientError
logger = logging.getLogger(__name__)
The provided code snippet includes necessary dependencies for implementing the `terminate_cluster` function. Write a Python function `def terminate_cluster(cluster_id, emr_client)` to solve the following problem:
Terminates... | Terminates a cluster. This terminates all instances in the cluster and cannot be undone. Any data not saved elsewhere, such as in an Amazon S3 bucket, is lost. :param cluster_id: The ID of the cluster to terminate. :param emr_client: The Boto3 EMR client object. |
27,456 | import logging
from botocore.exceptions import ClientError
logger = logging.getLogger(__name__)
The provided code snippet includes necessary dependencies for implementing the `add_step` function. Write a Python function `def add_step(cluster_id, name, script_uri, script_args, emr_client)` to solve the following proble... | Adds a job step to the specified cluster. This example adds a Spark step, which is run by the cluster as soon as it is added. :param cluster_id: The ID of the cluster. :param name: The name of the step. :param script_uri: The URI where the Python script is stored. :param script_args: Arguments to pass to the Python scr... |
27,457 | import logging
from botocore.exceptions import ClientError
logger = logging.getLogger(__name__)
The provided code snippet includes necessary dependencies for implementing the `describe_step` function. Write a Python function `def describe_step(cluster_id, step_id, emr_client)` to solve the following problem:
Gets deta... | Gets detailed information about the specified step, including the current state of the step. :param cluster_id: The ID of the cluster. :param step_id: The ID of the step. :param emr_client: The Boto3 EMR client object. :return: The retrieved information about the specified step. |
27,458 | import json
import logging
import random
import sys
import time
from datetime import datetime
from typing import List
from botocore.exceptions import ClientError
from mage_ai.services.aws import get_aws_boto3_client
from mage_ai.services.aws.emr import emr_basics
from mage_ai.services.aws.emr.config import EmrConfig
fr... | null |
27,459 | import json
import logging
import random
import sys
import time
from datetime import datetime
from typing import List
from botocore.exceptions import ClientError
from mage_ai.services.aws import get_aws_boto3_client
from mage_ai.services.aws.emr import emr_basics
from mage_ai.services.aws.emr.config import EmrConfig
fr... | null |
27,460 | import json
from typing import Dict, List, Union
from mage_ai.services.aws import get_aws_boto3_client
from mage_ai.services.aws.ecs.config import EcsConfig
def get_aws_boto3_client(aws_service):
import boto3
from botocore.config import Config
config = Config(region_name=get_aws_region_name())
kwargs ... | null |
27,461 | import json
from typing import Dict, List, Union
from mage_ai.services.aws import get_aws_boto3_client
from mage_ai.services.aws.ecs.config import EcsConfig
def get_aws_boto3_client(aws_service):
import boto3
from botocore.config import Config
config = Config(region_name=get_aws_region_name())
kwargs ... | null |
27,462 | import json
from typing import Dict, List, Union
from mage_ai.services.aws import get_aws_boto3_client
from mage_ai.services.aws.ecs.config import EcsConfig
def get_aws_boto3_client(aws_service):
def list_tasks(cluster) -> List[Dict]:
ecs_client = get_aws_boto3_client('ecs')
task_arns = ecs_client.list_tasks... | null |
27,463 | import json
from typing import Dict, List, Union
from mage_ai.services.aws import get_aws_boto3_client
from mage_ai.services.aws.ecs.config import EcsConfig
def get_aws_boto3_client(aws_service):
import boto3
from botocore.config import Config
config = Config(region_name=get_aws_region_name())
kwargs ... | null |
27,464 | import os
import uuid
from mage_ai.services.aws import get_aws_boto3_client
EVENT_RULE_LIMIT = 100
def get_aws_boto3_client(aws_service):
def get_all_event_rules():
client = get_aws_boto3_client('events')
response = client.list_rules(
Limit=EVENT_RULE_LIMIT
)
formatted_rules = [
dict(... | null |
27,465 | import os
import uuid
from mage_ai.services.aws import get_aws_boto3_client
def get_aws_boto3_client(aws_service):
import boto3
from botocore.config import Config
config = Config(region_name=get_aws_region_name())
kwargs = dict()
aws_access_key_id = get_aws_access_key_id()
if aws_access_key_i... | null |
27,466 | import os
from typing import List
from thefuzz import fuzz
from mage_ai.cache.block_action_object import BlockActionObjectCache
from mage_ai.cache.block_action_object.constants import (
OBJECT_TYPE_BLOCK_FILE,
OBJECT_TYPE_MAGE_TEMPLATE,
)
from mage_ai.shared.custom_logger import DX_PRINTER
DEFAULT_RATIO = 50
de... | null |
27,467 | import requests
from mage_ai.services.discord.config import DiscordConfig
class DiscordConfig(BaseConfig):
webhook_url: str = None
def is_valid(self) -> bool:
return self.webhook_url is not None and self.webhook_url != 'None'
def send_discord_message(config: DiscordConfig, message: str, title: str) -... | null |
27,468 | import os
from typing import List
from mage_ai.services.spark.config import SparkConfig
def has_same_spark_config(spark_session, spark_config: SparkConfig) -> bool:
"""
Checks if the spark session has the same configuration as the spark config.
Args:
spark_session (SparkSession): The spark session.
... | Gets a Spark session. If the given spark_config is None, then create a Spark session with the default configuration. If the given spark_config is not None, then check if the active Spark session has the same configuration as the given spark_config. If the active Spark session has the same configuration as the given spa... |
27,469 | import os
import time
from typing import Dict, Union
from kubernetes import client, config
from kubernetes.client import V1Container, V1PodSpec
from kubernetes.client.rest import ApiException
from mage_ai.services.k8s.config import K8sExecutorConfig
from mage_ai.services.k8s.constants import (
DEFAULT_NAMESPACE,
... | null |
27,470 | import os
import time
from typing import Dict, Union
from kubernetes import client, config
from kubernetes.client import V1Container, V1PodSpec
from kubernetes.client.rest import ApiException
from mage_ai.services.k8s.config import K8sExecutorConfig
from mage_ai.services.k8s.constants import (
DEFAULT_NAMESPACE,
... | Merge two V1Container objects. The merging process follows these rules: - For non-list and non-dict attributes, if the attribute in `left` is not None, use that; otherwise, use the attribute in `right`. - For list attributes (excluding 'command'), append non-duplicate elements from `right` to `left`. - For the 'command... |
27,471 | from mage_ai.services.opsgenie.config import OpsgenieConfig
import requests
import json
class OpsgenieConfig(BaseConfig):
url: str = None
api_key: str = None
priority: str = "P3"
responders: List[Dict] = field(default_factory=list)
tags: List = field(default_factory=list)
details: Dict = field(... | Opens an alert in Opsgenie with the given message and description. Args: config (OpsgenieConfig): Opsgenie config dataclass message (str): The title of the alert. description (str): The message body of the alert. |
27,472 | from mage_ai.services.teams.config import TeamsConfig
import requests
class TeamsConfig(BaseConfig):
webhook_url: str = None
def is_valid(self) -> bool:
return self.webhook_url is not None and self.webhook_url != 'None'
def send_teams_message(
config: TeamsConfig,
message: str,
title: str... | null |
27,473 | import json
import requests
from mage_ai.services.slack.config import SlackConfig
class SlackConfig(BaseConfig):
webhook_url: str = None
def is_valid(self) -> bool:
return self.webhook_url is not None and self.webhook_url != 'None'
def send_slack_message(config: SlackConfig, message: str, title: str ... | null |
27,474 | from mage_ai.services.google_chat.config import GoogleChatConfig
import requests
class GoogleChatConfig(BaseConfig):
def is_valid(self) -> bool:
def send_google_chat_message(
config: GoogleChatConfig,
message: str,
title: str = 'Mage pipeline run status logs',
) -> None:
requests.post(
ur... | null |
27,475 | import requests
from mage_ai.services.telegram.config import TelegramConfig
class TelegramConfig(BaseConfig):
webhook_url: str = None
def is_valid(self) -> bool:
return self.webhook_url is not None and self.webhook_url != 'None'
def send_telegram_message(config: TelegramConfig, message: str, title: s... | null |
27,476 | import smtplib
from email.message import EmailMessage
from mage_ai.services.email.config import EmailConfig
class EmailConfig(BaseConfig):
smtp_host: str
smtp_mail_from: str
smtp_user: str = None
smtp_password: str = None
smtp_starttls: bool = True
smtp_ssl: bool = False
smtp_port: int = 58... | null |
27,477 | import os
from typing import Dict, List, Tuple
from mage_ai.data_preparation.models.constants import (
PIPELINE_CONFIG_FILE,
PIPELINES_FOLDER,
)
from mage_ai.settings.platform import (
build_repo_path_for_all_projects,
get_repo_paths_for_file_path,
project_platform_activated,
repo_path_from_data... | null |
27,478 | import os
from typing import Dict, List, Tuple
from mage_ai.data_preparation.models.constants import (
PIPELINE_CONFIG_FILE,
PIPELINES_FOLDER,
)
from mage_ai.settings.platform import (
build_repo_path_for_all_projects,
get_repo_paths_for_file_path,
project_platform_activated,
repo_path_from_data... | null |
27,479 | import secrets
import string
def generate_jwt_secret(length=64):
characters = string.ascii_letters + string.digits
return ''.join(secrets.choice(characters) for _ in range(length)) | null |
27,480 | import os
from .secret_generation import generate_jwt_secret
try:
DISABLE_NOTEBOOK_EDIT_ACCESS = int(os.getenv('DISABLE_NOTEBOOK_EDIT_ACCESS', 0))
except ValueError:
DISABLE_NOTEBOOK_EDIT_ACCESS = 1 if os.getenv('DISABLE_NOTEBOOK_EDIT_ACCESS') else 0
def is_disable_pipeline_edit_access(
disable_notebook_ed... | null |
27,481 | import os
from .secret_generation import generate_jwt_secret
The provided code snippet includes necessary dependencies for implementing the `get_bool_value` function. Write a Python function `def get_bool_value(value: str) -> bool` to solve the following problem:
Converts a string environment variable to a bool value.... | Converts a string environment variable to a bool value. Returns True if the value is 'true', '1', or 't' (case insensitive). Otherwise, False |
27,482 | import asyncio
import os
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from typing import Dict, Union
import aiofiles
import yaml
from jinja2 import Template
from mage_ai.authentication.permissions.constants import EntityName
from mage_ai.data_preparation.models.constants import Block... | null |
27,483 | import os
from datetime import datetime
from typing import Dict, List
from mage_ai.cluster_manager.constants import (
ECS_CLUSTER_NAME,
GCP_PATH_TO_KEYFILE,
GCP_PROJECT_ID,
GCP_REGION,
KUBE_NAMESPACE,
ClusterType,
)
from mage_ai.cluster_manager.workspace.base import Workspace
from mage_ai.data_p... | Check and potentially terminate idle workspaces in a given cluster. Currently, this is only supported for Kubernetes clusters. This function is responsible for checking and, if necessary, terminating idle workspaces in a specified cluster. 1. Retrieve a list of workspaces based on the cluster_type by calling get_worksp... |
27,484 | import time
from collections.abc import Iterable
from dataclasses import dataclass
from typing import Dict, List
from influxdb_client import InfluxDBClient, WriteOptions, WritePrecision
from mage_ai.shared.config import BaseConfig
from mage_ai.streaming.constants import DEFAULT_BATCH_SIZE, DEFAULT_TIMEOUT_MS
from mage_... | null |
27,485 | import datetime
import time
from dataclasses import dataclass
from typing import Callable, Tuple
from influxdb_client import InfluxDBClient, QueryApi
from influxdb_client.client.flux_table import TableList
from mage_ai.shared.config import BaseConfig
from mage_ai.streaming.constants import DEFAULT_BATCH_SIZE
from mage_... | Build flux query for data in the range (start_time - time_delay, stop_time - time_delay) Args: bucket (str): Bucket to query from. stop_time (float): Time range stop timestamp. time_delay (str): Flux duration. E.g. 3d12h4m25s for 3 days, 12 hours, 4 minutes, and 25 seconds. Documentation: https://docs.influxdata.com/fl... |
27,486 | import datetime
import time
from dataclasses import dataclass
from typing import Callable, Tuple
from influxdb_client import InfluxDBClient, QueryApi
from influxdb_client.client.flux_table import TableList
from mage_ai.shared.config import BaseConfig
from mage_ai.streaming.constants import DEFAULT_BATCH_SIZE
from mage_... | null |
27,487 | import time
import uuid
from dataclasses import dataclass
from typing import Callable
import stomp
from stomp.exception import ConnectFailedException
from mage_ai.shared.config import BaseConfig
from mage_ai.streaming.sources.base import BaseSource
def messageProcessingFunction(message, handler):
print('Recieved m... | null |
27,488 | import multiprocessing
import time
import traceback
from contextlib import nullcontext
from enum import Enum
import newrelic.agent
import sentry_sdk
from mage_ai.orchestration.db.database_manager import database_manager
from mage_ai.orchestration.db.process import create_process
from mage_ai.server.logger import Logger... | null |
27,489 | import multiprocessing
import time
import traceback
from contextlib import nullcontext
from enum import Enum
import newrelic.agent
import sentry_sdk
from mage_ai.orchestration.db.database_manager import database_manager
from mage_ai.orchestration.db.process import create_process
from mage_ai.server.logger import Logger... | null |
27,490 | import importlib
import json
import subprocess
import traceback
from typing import Dict, List
from mage_ai.data_integrations.utils.settings import get_uuid
from mage_ai.data_preparation.models.constants import PYTHON_COMMAND
from mage_ai.server.logger import Logger
def build_integration_module_info(key: str, option: Di... | null |
27,491 | from typing import Dict
from jupyter_client import KernelClient, KernelManager
from jupyter_client.kernelspec import NoSuchKernel
from mage_ai.data_preparation.models.project import Project
from mage_ai.data_preparation.models.project.constants import FeatureUUID
from mage_ai.server.kernels import DEFAULT_KERNEL_NAME, ... | null |
27,492 | from typing import Dict
from jupyter_client import KernelClient, KernelManager
from jupyter_client.kernelspec import NoSuchKernel
from mage_ai.data_preparation.models.project import Project
from mage_ai.data_preparation.models.project.constants import FeatureUUID
from mage_ai.server.kernels import DEFAULT_KERNEL_NAME, ... | null |
27,493 | from typing import Dict
from jupyter_client import KernelClient, KernelManager
from jupyter_client.kernelspec import NoSuchKernel
from mage_ai.data_preparation.models.project import Project
from mage_ai.data_preparation.models.project.constants import FeatureUUID
from mage_ai.server.kernels import DEFAULT_KERNEL_NAME, ... | null |
27,494 | from datetime import datetime
from mage_ai.server.active_kernel import get_active_kernel_client
from mage_ai.server.logger import Logger
logger = Logger().new_server_logger(__name__)
def get_active_kernel_client() -> KernelClient:
def get_messages(callback=None):
now = datetime.utcnow()
while True:
t... | null |
27,495 | import json
from jupyter_client import KernelClient
from mage_ai.api.errors import ApiError
from mage_ai.api.utils import authenticate_client_and_token
from mage_ai.orchestration.db.models.oauth import Oauth2Application
from mage_ai.server.kernel_output_parser import DataType
from mage_ai.server.websockets.constants im... | null |
27,496 | import json
from jupyter_client import KernelClient
from mage_ai.api.errors import ApiError
from mage_ai.api.utils import authenticate_client_and_token
from mage_ai.orchestration.db.models.oauth import Oauth2Application
from mage_ai.server.kernel_output_parser import DataType
from mage_ai.server.websockets.constants im... | null |
27,497 | import json
from jupyter_client import KernelClient
from mage_ai.api.errors import ApiError
from mage_ai.api.utils import authenticate_client_and_token
from mage_ai.orchestration.db.models.oauth import Oauth2Application
from mage_ai.server.kernel_output_parser import DataType
from mage_ai.server.websockets.constants im... | null |
27,498 | import json
from jupyter_client import KernelClient
from mage_ai.api.errors import ApiError
from mage_ai.api.utils import authenticate_client_and_token
from mage_ai.orchestration.db.models.oauth import Oauth2Application
from mage_ai.server.kernel_output_parser import DataType
from mage_ai.server.websockets.constants im... | null |
27,499 | import uuid
from dataclasses import dataclass
from typing import Dict, List, Union
from jupyter_client import KernelClient
from mage_ai.server.active_kernel import (
get_active_kernel_client,
get_active_kernel_name,
switch_active_kernel,
)
from mage_ai.server.kernel_output_parser import DataType
from mage_a... | null |
27,500 | from typing import List
The provided code snippet includes necessary dependencies for implementing the `build_color_commands` function. Write a Python function `def build_color_commands(uuid: str = None) -> List[str]` to solve the following problem:
Enter this in your terminal to view available colors:
Here is the fu... | Enter this in your terminal to view available colors: |
27,501 | import argparse
import asyncio
import json
import os
import shutil
import stat
import traceback
import webbrowser
from datetime import datetime
from time import sleep
from typing import Optional, Union
import pytz
import tornado.ioloop
import tornado.web
from tornado import autoreload
from tornado.ioloop import Periodi... | This function will create the BASE_PATH_EXPORTS_FOLDER and replace all the occurrences of CLOUD_NOTEBOOK_BASE_PATH_PLACEHOLDER_ with the base_path parameter. Args: base_path (str): The base path to replace the placeholder with. Returns: str: The path of the frontend static export folder with the replaced base paths. |
27,502 | import argparse
import asyncio
import json
import os
import shutil
import stat
import traceback
import webbrowser
from datetime import datetime
from time import sleep
from typing import Optional, Union
import pytz
import tornado.ioloop
import tornado.web
from tornado import autoreload
from tornado.ioloop import Periodi... | null |
27,503 | import argparse
import asyncio
import json
import os
import shutil
import stat
import traceback
import webbrowser
from datetime import datetime
from time import sleep
from typing import Optional, Union
import pytz
import tornado.ioloop
import tornado.web
from tornado import autoreload
from tornado.ioloop import Periodi... | null |
27,504 | from distutils.file_util import copy_file
from mage_ai.data_preparation.models.constants import PIPELINE_CONFIG_FILE
from mage_ai.data_preparation.models.pipeline import Pipeline
from typing import Callable
import asyncio
import multiprocessing
import os
import shutil
pipeline_execution = PipelineExecution()
class Pip... | null |
27,505 | from distutils.file_util import copy_file
from mage_ai.data_preparation.models.constants import PIPELINE_CONFIG_FILE
from mage_ai.data_preparation.models.pipeline import Pipeline
from typing import Callable
import asyncio
import multiprocessing
import os
import shutil
pipeline_execution = PipelineExecution()
The provi... | Set the process that the current pipeline execution is running in. |
27,506 | from distutils.file_util import copy_file
from mage_ai.data_preparation.models.constants import PIPELINE_CONFIG_FILE
from mage_ai.data_preparation.models.pipeline import Pipeline
from typing import Callable
import asyncio
import multiprocessing
import os
import shutil
pipeline_execution = PipelineExecution()
The provi... | Set the task that current is processing messages from execution process. |
27,507 | from distutils.file_util import copy_file
from mage_ai.data_preparation.models.constants import PIPELINE_CONFIG_FILE
from mage_ai.data_preparation.models.pipeline import Pipeline
from typing import Callable
import asyncio
import multiprocessing
import os
import shutil
pipeline_execution = PipelineExecution()
def delete... | Cancel the current pipeline execution running in the saved process if the process is alive. |
27,508 | from distutils.file_util import copy_file
from mage_ai.data_preparation.models.constants import PIPELINE_CONFIG_FILE
from mage_ai.data_preparation.models.pipeline import Pipeline
from typing import Callable
import asyncio
import multiprocessing
import os
import shutil
pipeline_execution = PipelineExecution()
The provi... | Reset state on the execution manager. |
27,509 | from distutils.file_util import copy_file
from mage_ai.data_preparation.models.constants import PIPELINE_CONFIG_FILE
from mage_ai.data_preparation.models.pipeline import Pipeline
from typing import Callable
import asyncio
import multiprocessing
import os
import shutil
pipeline_execution = PipelineExecution()
The provi... | Save the path where we save the copy of the pipeline config before running the execution. |
27,510 | from enum import Enum
from mage_ai.data_preparation.models.constants import MAX_PRINT_OUTPUT_LINES
class DataType(str, Enum):
DATA_FRAME = 'data_frame'
IMAGE_PNG = 'image/png'
PROGRESS = 'progress'
TABLE = 'table'
TEXT = 'text'
TEXT_HTML = 'text/html'
TEXT_PLAIN = 'text/plain'
COMMS_MESSAGE_... | null |
27,511 | import asyncio
import json
import multiprocessing
import os
import re
import traceback
import uuid
from datetime import datetime, timedelta
from distutils.file_util import copy_file
from typing import Dict, List
import tornado.websocket
from jupyter_client import KernelClient
from mage_ai.api.errors import ApiError
fro... | Execute pipeline synchronously. This function is meant to be run in a separate process, and will write status messages to the passed in multiprocessing queue. |
27,512 | import asyncio
import json
import multiprocessing
import os
import re
import traceback
import uuid
from datetime import datetime, timedelta
from distutils.file_util import copy_file
from typing import Dict, List
import tornado.websocket
from jupyter_client import KernelClient
from mage_ai.api.errors import ApiError
fro... | null |
27,513 | from IPython import get_ipython
from IPython.display import IFrame, Javascript, display
from enum import Enum
from mage_ai.server.app import (
server_config,
)
from mage_ai.server.constants import SERVER_PORT
from mage_ai.server.logger import Logger
import os
class NotebookType(str, Enum):
DATABRICKS = 'databri... | null |
27,514 | from IPython import get_ipython
from IPython.display import IFrame, Javascript, display
from enum import Enum
from mage_ai.server.app import (
server_config,
)
from mage_ai.server.constants import SERVER_PORT
from mage_ai.server.logger import Logger
import os
IFRAME_HEIGHT = 1000
class NotebookType(str, Enum):
... | null |
27,515 | from IPython import get_ipython
from IPython.display import IFrame, Javascript, display
from enum import Enum
from mage_ai.server.app import (
server_config,
)
from mage_ai.server.constants import SERVER_PORT
from mage_ai.server.logger import Logger
import os
logger = Logger().new_server_logger(__name__)
class Note... | null |
27,516 | import json
import re
from typing import Dict, List
from mage_ai.data_preparation.models.block.dynamic.utils import (
has_reduce_output_from_upstreams,
is_dynamic_block,
is_dynamic_block_child,
)
from mage_ai.data_preparation.models.constants import (
DATAFRAME_ANALYSIS_MAX_COLUMNS,
DATAFRAME_SAMPLE... | null |
27,517 | import json
import re
from typing import Dict, List
from mage_ai.data_preparation.models.block.dynamic.utils import (
has_reduce_output_from_upstreams,
is_dynamic_block,
is_dynamic_block_child,
)
from mage_ai.data_preparation.models.constants import (
DATAFRAME_ANALYSIS_MAX_COLUMNS,
DATAFRAME_SAMPLE... | null |
27,518 | import json
import re
from typing import Dict, List
from mage_ai.data_preparation.models.block.dynamic.utils import (
has_reduce_output_from_upstreams,
is_dynamic_block,
is_dynamic_block_child,
)
from mage_ai.data_preparation.models.constants import (
DATAFRAME_ANALYSIS_MAX_COLUMNS,
DATAFRAME_SAMPLE... | null |
27,519 | import json
import re
from typing import Dict, List
from mage_ai.data_preparation.models.block.dynamic.utils import (
has_reduce_output_from_upstreams,
is_dynamic_block,
is_dynamic_block_child,
)
from mage_ai.data_preparation.models.constants import (
DATAFRAME_ANALYSIS_MAX_COLUMNS,
DATAFRAME_SAMPLE... | null |
27,520 | import importlib
import re
from typing import Tuple
from mage_ai.autocomplete.utils import extract_all_imports
from mage_ai.settings.repo import get_repo_path
def extract_decorated_function(code: str, decorated_function_name: str) -> Tuple:
spans = []
span_current_start = None
span_current_def = None
... | null |
27,522 | import json
from typing import Dict, List
from mage_integrations.destinations.constants import (
COLUMN_FORMAT_DATETIME,
COLUMN_TYPE_ARRAY,
COLUMN_TYPE_OBJECT,
COLUMN_TYPE_STRING,
)
from mage_integrations.destinations.snowflake.constants import (
SNOWFLAKE_COLUMN_TYPE_VARIANT,
)
from mage_integratio... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.