Module sktmls.channels
Sub-modules
sktmls.channels.channel
Classes
class Channel (**kwargs)
-
MLS 채널 클래스입니다.
Args
- kwargs
- id: (int) 채널 고유 ID
- screen_id: (str) 채널 이름
- experiments: (list(int)) 연결된 실험 ID 리스트
- user: (str) 채널 생성 계정명
- created_at: (datetime) 생성일시
- updated_at: (datetime) 수정일시
Returns
Methods
def get(self)
def reset(self, **kwargs)
- kwargs
class ChannelClient (env: MLSENV = None, runtime_env: MLSRuntimeENV = None, username: str = None, password: str = None)
-
MLS 채널 관련 기능들을 제공하는 클라이언트입니다.
Args
- env: (
MLSENV
) 접근할 MLS 환경 (MLSENV.DEV
|MLSENV.STG
|MLSENV.PRD
) (기본값:MLSENV.STG
) - runtime_env: (
MLSRuntimeENV
) 클라이언트가 실행되는 환경 (MLSRuntimeENV.YE
|MLSRuntimeENV.EDD
|MLSRuntimeENV.LOCAL
) (기본값:MLSRuntimeENV.LOCAL
) - username: (str) MLS 계정명 (기본값: $MLS_USERNAME)
- password: (str) MLS 계정 비밀번호 (기본값: $MLS_PASSWORD)
아래의 환경 변수가 정의된 경우 해당 파라미터를 생략 가능합니다.
- $MLS_ENV: env
- $MLS_RUNTIME_ENV: runtime_env
- $MLS_USERNAME: username
- $MLS_PASSWORD: password
Returns
Example
channel_client = ChannelClient(env=MLSENV.STG, runtime_env=MLSRuntimeENV.YE, username="mls_account", password="mls_password")
Ancestors
Methods
def create_channel(self, name: str, experiments: List[ForwardRef('Experiment')]) ‑> Channel
-
채널를 생성합니다.
Args
- name: (str) 채널 이름
- experiments: (list(
Experiment
)) 실험 객체 리스트
Returns
- id: (int) 채널 고유 ID
- screen_id: (str) 채널 이름
- experiments: (list(int)) 연결된 실험 ID 리스트
- user: (str) 채널 생성 계정명
- created_at: (datetime) 생성일시
- updated_at: (datetime) 수정일시
Example
experiment_1 = experiment_client.get_experiment(name="my_experiment_1") experiment_2 = experiment_client.get_experiment(name="my_experiment_2") channel = channel_client.create_channel( name="my_channel", experiments=[ experiment_1, experiment_2, ] )
def delete_channel(self, channel: Channel) ‑> MLSResponse
def get_channel(self, id: int = None, name: str = None) ‑> Channel
-
채널 정보를 가져옵니다.
Args:
id
또는name
중 한 개 이상의 값이 반드시 전달되어야 합니다.- id: (optional) (int) 채널 고유 ID
- name: (optional) (str) 채널 이름
Returns
- id: (int) 채널 고유 ID
- screen_id: (str) 채널 이름
- experiments: (list(int)) 연결된 실험 ID 리스트
- user: (str) 채널 생성 계정명
- created_at: (datetime) 생성일시
- updated_at: (datetime) 수정일시
Example
channel_by_id = channel_client.get_channel( id=3 ) channel_by_name = channel_client.get_channel( name="my_channel" )
def list_channels(self, **kwargs) ‑> List[Channel]
-
채널 리스트를 가져옵니다. (채널 조건 제외)
Args
- kwargs: (optional) (dict) 채널 조건
- id: (int) 채널 고유 ID
- name: (str) 채널 이름
- query: (str) 검색 문자
- page: (int) 페이지 번호
Returns
list(
Channel
)- id: (int) 채널 고유 ID
- name: (str) 채널 이름
- created_at: (datetime) 생성일시
- updated_at: (datetime) 수정일시
Example
channels = channel_client.list_channels()
- kwargs: (optional) (dict) 채널 조건
def update_channel(self, channel: Channel, name: str = None, experiments: List[ForwardRef('Experiment')] = None) ‑> Channel
-
채널 정보를 수정합니다.
Args
- channel: (
Channel
) 채널 객체 - name: (optional) (str) 채널 이름
- experiments: (optional) (list(
Experiment
)) 실험 객체 리스트
Returns
- id: (int) 채널 고유 ID
- screen_id: (str) 채널 이름
- experiments: (list(int)) 연결된 실험 ID 리스트
- user: (str) 채널 생성 계정명
- created_at: (datetime) 생성일시
- updated_at: (datetime) 수정일시
Example
experiment_new = experiment_client.get_experiment(name="my_experiment_new") channel = channel_clinet.get_channel(name="my_channel") channel = channel_client.update_channel( channel=channel, name="my_updated_channel", experiments=[experiment_new], )
- channel: (
- env: (