id
int64
1
6.07M
name
stringlengths
1
295
code
stringlengths
12
426k
language
stringclasses
1 value
source_file
stringlengths
5
202
start_line
int64
1
158k
end_line
int64
1
158k
repo
dict
4,001
__init__
def __init__(self, api: Api, config: Dict[str, Any]): """Initialize a launch agent. Arguments: api: Api object to use for making requests to the backend. config: Config dictionary for the agent. """ self._entity = config["entity"] self._project = config["...
python
wandb/sdk/launch/agent/agent.py
127
174
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,002
fail_run_queue_item
def fail_run_queue_item(self, run_queue_item_id: str) -> None: if self._gorilla_supports_fail_run_queue_items: self._api.fail_run_queue_item(run_queue_item_id)
python
wandb/sdk/launch/agent/agent.py
176
178
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,003
thread_ids
def thread_ids(self) -> List[int]: """Returns a list of keys running thread ids for the agent.""" with self._jobs_lock: return list(self._jobs.keys())
python
wandb/sdk/launch/agent/agent.py
181
184
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,004
num_running_schedulers
def num_running_schedulers(self) -> int: """Return just the number of schedulers.""" with self._jobs_lock: return len([x for x in self._jobs if self._jobs[x].is_scheduler])
python
wandb/sdk/launch/agent/agent.py
187
190
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,005
num_running_jobs
def num_running_jobs(self) -> int: """Return the number of jobs not including schedulers.""" with self._jobs_lock: return len([x for x in self._jobs if not self._jobs[x].is_scheduler])
python
wandb/sdk/launch/agent/agent.py
193
196
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,006
pop_from_queue
def pop_from_queue(self, queue: str) -> Any: """Pops an item off the runqueue to run as a job. Arguments: queue: Queue to pop from. Returns: Item popped off the queue. Raises: Exception: if there is an error popping from the queue. """ ...
python
wandb/sdk/launch/agent/agent.py
198
220
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,007
print_status
def print_status(self) -> None: """Prints the current status of the agent.""" output_str = "agent " if self._name: output_str += f"{self._name} " if self.num_running_jobs < self._max_jobs: output_str += "polling on " if self._project != LAUNCH_DEFAULT_...
python
wandb/sdk/launch/agent/agent.py
222
240
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,008
update_status
def update_status(self, status: str) -> None: """Update the status of the agent. Arguments: status: Status to update the agent to. """ update_ret = self._api.update_launch_agent_status( self._id, status, self.gorilla_supports_agents ) if not updat...
python
wandb/sdk/launch/agent/agent.py
242
252
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,009
finish_thread_id
def finish_thread_id(self, thread_id: int) -> None: """Removes the job from our list for now.""" job_and_run_status = self._jobs[thread_id] if not job_and_run_status.run_id or not job_and_run_status.project: self.fail_run_queue_item(job_and_run_status.run_queue_item_id) else:...
python
wandb/sdk/launch/agent/agent.py
254
280
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,010
_update_finished
def _update_finished(self, thread_id: int) -> None: """Check our status enum.""" with self._jobs_lock: job = self._jobs[thread_id] if job.job_completed: self.finish_thread_id(thread_id)
python
wandb/sdk/launch/agent/agent.py
282
287
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,011
run_job
def run_job(self, job: Dict[str, Any]) -> None: """Set up project and run the job. Arguments: job: Job to run. """ _msg = f"{LOG_PREFIX}Launch agent received job:\n{pprint.pformat(job)}\n" wandb.termlog(_msg) _logger.info(_msg) # update agent status ...
python
wandb/sdk/launch/agent/agent.py
289
319
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,012
loop
def loop(self) -> None: """Loop infinitely to poll for jobs and run them. Raises: KeyboardInterrupt: if the agent is requested to stop. """ self.print_status() try: while True: self._ticks += 1 agent_response = self._api.ge...
python
wandb/sdk/launch/agent/agent.py
321
387
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,013
thread_run_job
def thread_run_job( self, launch_spec: Dict[str, Any], job: Dict[str, Any], default_config: Dict[str, Any], api: Api, ) -> None: thread_id = threading.current_thread().ident assert thread_id is not None try: self._thread_run_job(launch_spec...
python
wandb/sdk/launch/agent/agent.py
390
410
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,014
_thread_run_job
def _thread_run_job( self, launch_spec: Dict[str, Any], job: Dict[str, Any], default_config: Dict[str, Any], api: Api, thread_id: int, ) -> None: job_tracker = JobAndRunStatus(job["runQueueItemId"]) with self._jobs_lock: self._jobs[thread_i...
python
wandb/sdk/launch/agent/agent.py
412
470
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,015
_check_run_finished
def _check_run_finished(self, job_tracker: JobAndRunStatus) -> bool: if job_tracker.completed: return True # the run can be done before the run has started # but can also be none if the run failed to start # so if there is no run, either the run hasn't started yet # ...
python
wandb/sdk/launch/agent/agent.py
472
515
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,016
__init__
def __init__( self, *args: Any, num_workers: int = 8, heartbeat_queue_timeout: float = 1.0, heartbeat_queue_sleep: float = 1.0, **kwargs: Any, ): super().__init__(*args, **kwargs) self._num_workers: int = num_workers # Thread will pop items off...
python
wandb/sdk/launch/sweeps/scheduler_sweep.py
27
42
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,017
_start
def _start(self) -> None: for worker_id in range(self._num_workers): _logger.debug(f"{LOG_PREFIX}Starting AgentHeartbeat worker {worker_id}\n") agent_config = self._api.register_agent( f"{socket.gethostname()}-{worker_id}", # host sweep_id=self._sweep_id,...
python
wandb/sdk/launch/sweeps/scheduler_sweep.py
44
56
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,018
_get_sweep_commands
def _get_sweep_commands(self, worker_id: int) -> List[Dict[str, Any]]: # AgentHeartbeat wants a Dict of runs which are running or queued _run_states: Dict[str, bool] = {} for run_id, run in self._yield_runs(): # Filter out runs that are from a different worker thread if r...
python
wandb/sdk/launch/sweeps/scheduler_sweep.py
58
74
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,019
_heartbeat
def _heartbeat(self, worker_id: int) -> bool: # Make sure Scheduler is alive if not self.is_alive(): return False elif self.state == SchedulerState.FLUSH_RUNS: # already hit run_cap, just noop return False commands: List[Dict[str, Any]] = self._get_sw...
python
wandb/sdk/launch/sweeps/scheduler_sweep.py
76
119
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,020
_run
def _run(self) -> None: # Go through all workers and heartbeat for worker_id in self._workers: self._heartbeat(worker_id) for _worker_id in self._workers: try: run: SweepRun = self._heartbeat_queue.get( timeout=self._heartbeat_queue_ti...
python
wandb/sdk/launch/sweeps/scheduler_sweep.py
121
147
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,021
_exit
def _exit(self) -> None: pass
python
wandb/sdk/launch/sweeps/scheduler_sweep.py
149
150
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,022
_import_sweep_scheduler
def _import_sweep_scheduler() -> Any: from .scheduler_sweep import SweepScheduler return SweepScheduler
python
wandb/sdk/launch/sweeps/__init__.py
15
18
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,023
load_scheduler
def load_scheduler(scheduler_name: str) -> Any: scheduler_name = scheduler_name.lower() if scheduler_name not in _WANDB_SCHEDULERS: raise SchedulerError( f"The `scheduler_name` argument must be one of " f"{list(_WANDB_SCHEDULERS.keys())}, got: {scheduler_name}" ) log...
python
wandb/sdk/launch/sweeps/__init__.py
26
36
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,024
__init__
def __init__( self, api: Api, *args: Optional[Any], sweep_id: Optional[str] = None, entity: Optional[str] = None, project: Optional[str] = None, project_queue: Optional[str] = None, **kwargs: Optional[Any], ): self._api = api self._enti...
python
wandb/sdk/launch/sweeps/scheduler.py
64
110
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,025
_start
def _start(self) -> None: pass
python
wandb/sdk/launch/sweeps/scheduler.py
113
114
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,026
_run
def _run(self) -> None: pass
python
wandb/sdk/launch/sweeps/scheduler.py
117
118
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,027
_exit
def _exit(self) -> None: pass
python
wandb/sdk/launch/sweeps/scheduler.py
121
122
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,028
state
def state(self) -> SchedulerState: _logger.debug(f"{LOG_PREFIX}Scheduler state is {self._state.name}") return self._state
python
wandb/sdk/launch/sweeps/scheduler.py
125
127
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,029
state
def state(self, value: SchedulerState) -> None: _logger.debug(f"{LOG_PREFIX}Scheduler was {self.state.name} is {value.name}") self._state = value
python
wandb/sdk/launch/sweeps/scheduler.py
130
132
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,030
is_alive
def is_alive(self) -> bool: if self.state in [ SchedulerState.COMPLETED, SchedulerState.FAILED, SchedulerState.STOPPED, SchedulerState.CANCELLED, ]: return False return True
python
wandb/sdk/launch/sweeps/scheduler.py
134
142
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,031
start
def start(self) -> None: """Start a scheduler, confirms prerequisites, begins execution loop.""" wandb.termlog(f"{LOG_PREFIX}Scheduler starting.") if not self.is_alive(): wandb.termerror( f"{LOG_PREFIX}Sweep already {self.state.name.lower()}! Exiting..." )...
python
wandb/sdk/launch/sweeps/scheduler.py
144
162
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,032
run
def run(self) -> None: """Main run function for all external schedulers.""" wandb.termlog(f"{LOG_PREFIX}Scheduler Running.") self.state = SchedulerState.RUNNING try: while True: if not self.is_alive(): break self._update_run...
python
wandb/sdk/launch/sweeps/scheduler.py
164
191
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,033
exit
def exit(self) -> None: self._exit() if self.state not in [ SchedulerState.COMPLETED, SchedulerState.STOPPED, ]: self.state = SchedulerState.FAILED self._stop_runs()
python
wandb/sdk/launch/sweeps/scheduler.py
193
200
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,034
_try_load_executable
def _try_load_executable(self) -> bool: """Check existance of valid executable for a run. logs and returns False when job is unreachable """ if self._kwargs.get("job"): _public_api = public.Api() try: _job_artifact = _public_api.artifact(self._kwa...
python
wandb/sdk/launch/sweeps/scheduler.py
202
222
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,035
_yield_runs
def _yield_runs(self) -> Iterator[Tuple[str, SweepRun]]: """Thread-safe way to iterate over the runs.""" with self._threading_lock: yield from self._runs.items()
python
wandb/sdk/launch/sweeps/scheduler.py
224
227
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,036
_stop_runs
def _stop_runs(self) -> None: for run_id, _ in self._yield_runs(): wandb.termlog(f"{LOG_PREFIX}Stopping run {run_id}.") self._stop_run(run_id)
python
wandb/sdk/launch/sweeps/scheduler.py
229
232
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,037
_stop_run
def _stop_run(self, run_id: str) -> None: """Stop a run and removes it from the scheduler.""" if run_id in self._runs: run: SweepRun = self._runs[run_id] run.state = RunState.DEAD # TODO(hupo): Send command to backend to stop run wandb.termlog(f"{LOG_PREFI...
python
wandb/sdk/launch/sweeps/scheduler.py
234
240
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,038
_update_run_states
def _update_run_states(self) -> None: """Iterate through runs. Get state from backend and deletes runs if not in running state. Threadsafe. """ _runs_to_remove: List[str] = [] for run_id, run in self._yield_runs(): try: _state = self._api.get_run_stat...
python
wandb/sdk/launch/sweeps/scheduler.py
242
285
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,039
_add_to_launch_queue
def _add_to_launch_queue( self, run_id: Optional[str] = None, entry_point: Optional[List[str]] = None, config: Optional[Dict[str, Any]] = None, ) -> "public.QueuedRun": """Add a launch job to the Launch RunQueue. run_id: supplied by gorilla from agentHeartbeat ...
python
wandb/sdk/launch/sweeps/scheduler.py
287
336
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,040
verify
def verify(self) -> None: """Verify that the registry is configured correctly.""" raise NotImplementedError
python
wandb/sdk/launch/registry/abstract.py
14
16
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,041
get_username_password
def get_username_password(self) -> Tuple[str, str]: """Get the username and password for the registry. Returns: (str, str): The username and password. """ raise NotImplementedError
python
wandb/sdk/launch/registry/abstract.py
19
25
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,042
get_repo_uri
def get_repo_uri(self) -> str: """Get the URI for a repository. Returns: str: The URI. """ raise NotImplementedError
python
wandb/sdk/launch/registry/abstract.py
28
34
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,043
check_image_exists
def check_image_exists(self, image_uri: str) -> bool: """Check if an image exists in the registry. Arguments: image_uri (str): The URI of the image. Returns: bool: True if the image exists. """ raise NotImplementedError
python
wandb/sdk/launch/registry/abstract.py
37
46
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,044
from_config
def from_config( cls, config: dict, environment: "AbstractEnvironment", verify: bool = True ) -> "AbstractRegistry": """Create a registry from a config.""" raise NotImplementedError
python
wandb/sdk/launch/registry/abstract.py
50
54
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,045
__init__
def __init__(self, repo_name: str, environment: AwsEnvironment) -> None: """Initialize the Elastic Container Registry. Arguments: repo_name (str): The name of the repository. environment (AwsEnvironment): The AWS environment. Raises: LaunchError: If there is...
python
wandb/sdk/launch/registry/elastic_container_registry.py
34
50
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,046
from_config
def from_config( # type: ignore[override] cls, config: Dict, environment: AwsEnvironment, verify: bool = True, ) -> "ElasticContainerRegistry": """Create an Elastic Container Registry from a config. Arguments: config (dict): The config. envir...
python
wandb/sdk/launch/registry/elastic_container_registry.py
53
78
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,047
verify
def verify(self) -> None: """Verify that the registry is accessible and the configured repo exists. Raises: RegistryError: If there is an error verifying the registry. """ _logger.debug("Verifying Elastic Container Registry.") try: session = self.environm...
python
wandb/sdk/launch/registry/elastic_container_registry.py
80
99
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,048
get_username_password
def get_username_password(self) -> Tuple[str, str]: """Get the username and password for the registry. Returns: (str, str): The username and password. Raises: RegistryError: If there is an error getting the username and password. """ _logger.debug("Getti...
python
wandb/sdk/launch/registry/elastic_container_registry.py
101
124
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,049
get_repo_uri
def get_repo_uri(self) -> str: """Get the uri of the repository. Returns: str: The uri of the repository. """ return self.uri + "/" + self.repo_name
python
wandb/sdk/launch/registry/elastic_container_registry.py
126
132
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,050
check_image_exists
def check_image_exists(self, image_uri: str) -> bool: """Check if the image tag exists. Arguments: image_uri (str): The full image_uri. Returns: bool: True if the image tag exists. """ uri, tag = image_uri.split(":") if uri != self.get_repo_uri()...
python
wandb/sdk/launch/registry/elastic_container_registry.py
134
161
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,051
__init__
def __init__(self) -> None: """Initialize a local registry.""" pass
python
wandb/sdk/launch/registry/local_registry.py
19
21
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,052
from_config
def from_config( cls, config: dict, environment: "AbstractEnvironment", verify: bool = True ) -> "LocalRegistry": """Create a local registry from a config. Arguments: config (dict): The config. This is ignored. environment (AbstractEnvironment): The environment. This...
python
wandb/sdk/launch/registry/local_registry.py
24
36
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,053
verify
def verify(self) -> None: """Verify the local registry by doing nothing.""" pass
python
wandb/sdk/launch/registry/local_registry.py
38
40
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,054
get_username_password
def get_username_password(self) -> Tuple[str, str]: """Get the username and password of the local registry.""" raise LaunchError("Attempted to get username and password for LocalRegistry.")
python
wandb/sdk/launch/registry/local_registry.py
42
44
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,055
get_repo_uri
def get_repo_uri(self) -> str: """Get the uri of the local registry. Returns: An empty string. """ return ""
python
wandb/sdk/launch/registry/local_registry.py
46
51
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,056
check_image_exists
def check_image_exists(self, image_uri: str) -> bool: """Check if an image exists in the local registry. Arguments: image_uri (str): The uri of the image. Returns: bool: True. """ return docker_image_exists(image_uri)
python
wandb/sdk/launch/registry/local_registry.py
53
62
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,057
__init__
def __init__( self, repository: str, image_name: str, environment: GcpEnvironment, verify: bool = True, ) -> None: """Initialize the Google Artifact Registry. Arguments: repository: The repository name. image_name: The image name. ...
python
wandb/sdk/launch/registry/google_artifact_registry.py
45
78
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,058
uri
def uri(self) -> str: """The uri of the registry.""" return f"{self.environment.region}-docker.pkg.dev/{self.environment.project}/{self.repository}/{self.image_name}"
python
wandb/sdk/launch/registry/google_artifact_registry.py
81
83
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,059
uri
def uri(self, uri: str) -> None: """Set the uri of the registry.""" raise LaunchError("The uri of the Google Artifact Registry cannot be set.")
python
wandb/sdk/launch/registry/google_artifact_registry.py
86
88
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,060
from_config
def from_config( # type: ignore[override] cls, config: dict, environment: GcpEnvironment, verify: bool = True, ) -> "GoogleArtifactRegistry": """Create a Google Artifact Registry from a config. Arguments: config: A dictionary containing the following key...
python
wandb/sdk/launch/registry/google_artifact_registry.py
91
116
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,061
verify
def verify(self) -> None: """Verify the registry is properly configured. Raises: LaunchError: If the registry is not properly configured. """ credentials = self.environment.get_credentials() parent = ( f"projects/{self.environment.project}/locations/{self...
python
wandb/sdk/launch/registry/google_artifact_registry.py
118
148
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,062
get_username_password
def get_username_password(self) -> Tuple[str, str]: """Get the username and password for the registry. Returns: A tuple of the username and password. """ credentials = self.environment.get_credentials() return "oauth2accesstoken", credentials.token
python
wandb/sdk/launch/registry/google_artifact_registry.py
150
157
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,063
get_repo_uri
def get_repo_uri(self) -> str: """Get the URI for the given repository. Arguments: repo_name: The repository name. Returns: The repository URI. """ return ( f"{self.environment.region}-docker.pkg.dev/" f"{self.environment.project}...
python
wandb/sdk/launch/registry/google_artifact_registry.py
159
171
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,064
check_image_exists
def check_image_exists(self, image_uri: str) -> bool: """Check if the image exists. Arguments: image_uri: The image URI. Returns: True if the image exists, False otherwise. """ _logger.info( f"Checking if image {image_uri} exists. In Google A...
python
wandb/sdk/launch/registry/google_artifact_registry.py
173
203
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,065
verify
def verify(self) -> None: """Verify that the environment is configured correctly.""" raise NotImplementedError
python
wandb/sdk/launch/environment/abstract.py
11
13
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,066
upload_file
def upload_file(self, source: str, destination: str) -> None: """Upload a file from the local filesystem to storage in the environment.""" raise NotImplementedError
python
wandb/sdk/launch/environment/abstract.py
16
18
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,067
upload_dir
def upload_dir(self, source: str, destination: str) -> None: """Upload the contents of a directory from the local filesystem to the environment.""" raise NotImplementedError
python
wandb/sdk/launch/environment/abstract.py
21
23
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,068
verify_storage_uri
def verify_storage_uri(self, uri: str) -> None: """Verify that the storage URI is configured correctly.""" raise NotImplementedError
python
wandb/sdk/launch/environment/abstract.py
26
28
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,069
__init__
def __init__( self, region: str, access_key: str, secret_key: str, session_token: str, verify: bool = True, ) -> None: """Initialize the AWS environment. Arguments: region (str): The AWS region. Raises: LaunchError: If...
python
wandb/sdk/launch/environment/aws_environment.py
32
55
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,070
from_default
def from_default(cls, region: str, verify: bool = True) -> "AwsEnvironment": """Create an AWS environment from the default AWS environment. Arguments: region (str): The AWS region. verify (bool, optional): Whether to verify the AWS environment. Defaults to True. Returns...
python
wandb/sdk/launch/environment/aws_environment.py
58
90
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,071
from_config
def from_config( cls, config: Dict[str, str], verify: bool = True ) -> "AwsEnvironment": """Create an AWS environment from the default AWS environment. Arguments: config (dict): Configuration dictionary. verify (bool, optional): Whether to verify the AWS environment....
python
wandb/sdk/launch/environment/aws_environment.py
93
113
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,072
region
def region(self) -> str: """The AWS region.""" return self._region
python
wandb/sdk/launch/environment/aws_environment.py
116
118
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,073
region
def region(self, region: str) -> None: self._region = region
python
wandb/sdk/launch/environment/aws_environment.py
121
122
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,074
verify
def verify(self) -> None: """Verify that the AWS environment is configured correctly. Raises: LaunchError: If the AWS environment is not configured correctly. """ _logger.debug("Verifying AWS environment.") try: session = self.get_session() cl...
python
wandb/sdk/launch/environment/aws_environment.py
124
139
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,075
get_session
def get_session(self) -> "boto3.Session": # type: ignore """Get an AWS session. Returns: boto3.Session: The AWS session. Raises: LaunchError: If the AWS session could not be created. """ _logger.debug(f"Creating AWS session in region {self._region}") ...
python
wandb/sdk/launch/environment/aws_environment.py
141
159
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,076
upload_file
def upload_file(self, source: str, destination: str) -> None: """Upload a file to s3 from local storage. The destination is a valid s3 URI, e.g. s3://bucket/key and will be used as a prefix for the uploaded file. Only the filename of the source is kept in the upload key. So if the sou...
python
wandb/sdk/launch/environment/aws_environment.py
161
196
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,077
upload_dir
def upload_dir(self, source: str, destination: str) -> None: """Upload a directory to s3 from local storage. The upload will place the contents of the source directory in the destination with the same directory structure. So if the source is "foo/bar" and the destination is "s3://bucket...
python
wandb/sdk/launch/environment/aws_environment.py
198
246
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,078
verify_storage_uri
def verify_storage_uri(self, uri: str) -> None: """Verify that s3 storage is configured correctly. This will check that the bucket exists and that the credentials are configured correctly. Arguments: uri (str): The URI of the storage. Raises: LaunchErro...
python
wandb/sdk/launch/environment/aws_environment.py
248
276
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,079
__init__
def __init__(self, region: str, verify: bool = True) -> None: """Initialize the GCP environment. Arguments: region: The GCP region. verify: Whether to verify the credentials, region, and project. Raises: LaunchError: If verify is True and the environment is ...
python
wandb/sdk/launch/environment/gcp_environment.py
57
73
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,080
from_config
def from_config(cls, config: dict) -> "GcpEnvironment": """Create a GcpEnvironment from a config dictionary. Arguments: config: The config dictionary. Returns: GcpEnvironment: The GcpEnvironment. """ if config.get("type") != "gcp": raise Laun...
python
wandb/sdk/launch/environment/gcp_environment.py
76
96
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,081
project
def project(self) -> str: """Get the name of the gcp project. The project name is determined by the credentials, so this method verifies the credentials if they have not already been verified. Returns: str: The name of the gcp project. Raises: LaunchErr...
python
wandb/sdk/launch/environment/gcp_environment.py
99
116
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,082
get_credentials
def get_credentials(self) -> google.auth.credentials.Credentials: # type: ignore """Get the GCP credentials. Uses google.auth.default() to get the credentials. If the credentials are invalid, this method will refresh them. If the credentials are still invalid after refreshing, this met...
python
wandb/sdk/launch/environment/gcp_environment.py
118
163
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,083
verify
def verify(self) -> None: """Verify the credentials, region, and project. Credentials and region are verified by calling get_credentials(). The region and is verified by calling the compute API. Raises: LaunchError: If the credentials, region, or project are invalid. ...
python
wandb/sdk/launch/environment/gcp_environment.py
165
186
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,084
verify_storage_uri
def verify_storage_uri(self, uri: str) -> None: """Verify that a storage URI is valid. Arguments: uri: The storage URI. Raises: LaunchError: If the storage URI is invalid. """ match = GCS_URI_RE.match(uri) if not match: raise LaunchEr...
python
wandb/sdk/launch/environment/gcp_environment.py
188
207
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,085
upload_file
def upload_file(self, source: str, destination: str) -> None: """Upload a file to GCS. Arguments: source: The path to the local file. destination: The path to the GCS file. Raises: LaunchError: If the file cannot be uploaded. """ _logger.debu...
python
wandb/sdk/launch/environment/gcp_environment.py
209
235
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,086
upload_dir
def upload_dir(self, source: str, destination: str) -> None: """Upload a directory to GCS. Arguments: source: The path to the local directory. destination: The path to the GCS directory. Raises: LaunchError: If the directory cannot be uploaded. """ ...
python
wandb/sdk/launch/environment/gcp_environment.py
237
271
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,087
__init__
def __init__(self) -> None: """Initialize a local environment by doing nothing.""" pass
python
wandb/sdk/launch/environment/local_environment.py
12
14
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,088
from_config
def from_config( cls, config: Dict[str, Union[Dict[str, Any], str]] ) -> "LocalEnvironment": """Create a local environment from a config. Arguments: config (dict): The config. This is ignored. Returns: LocalEnvironment: The local environment. """ ...
python
wandb/sdk/launch/environment/local_environment.py
17
28
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,089
verify
def verify(self) -> None: """Verify that the local environment is configured correctly.""" raise LaunchError("Attempted to verify LocalEnvironment.")
python
wandb/sdk/launch/environment/local_environment.py
30
32
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,090
verify_storage_uri
def verify_storage_uri(self, uri: str) -> None: """Verify that the storage URI is configured correctly. Arguments: uri (str): The storage URI. This is ignored. """ raise LaunchError("Attempted to verify storage uri for LocalEnvironment.")
python
wandb/sdk/launch/environment/local_environment.py
34
40
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,091
upload_file
def upload_file(self, source: str, destination: str) -> None: """Upload a file from the local filesystem to storage in the environment. Arguments: source (str): The source file. This is ignored. destination (str): The destination file. This is ignored. """ raise ...
python
wandb/sdk/launch/environment/local_environment.py
42
49
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,092
upload_dir
def upload_dir(self, source: str, destination: str) -> None: """Upload the contents of a directory from the local filesystem to the environment. Arguments: source (str): The source directory. This is ignored. destination (str): The destination directory. This is ignored. ...
python
wandb/sdk/launch/environment/local_environment.py
51
58
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,093
get_project
def get_project(self) -> str: """Get the project of the local environment. Returns: An empty string. """ raise LaunchError("Attempted to get project for LocalEnvironment.")
python
wandb/sdk/launch/environment/local_environment.py
60
65
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,094
__init__
def __init__( self, environment: AbstractEnvironment, registry: AbstractRegistry, verify: bool = True, ) -> None: """Initialize a builder. Arguments: builder_config: The builder config. registry: The registry to use. verify: Whethe...
python
wandb/sdk/launch/builder/abstract.py
20
36
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,095
from_config
def from_config( cls, config: dict, environment: AbstractEnvironment, registry: AbstractRegistry, verify: bool = True, ) -> "AbstractBuilder": """Create a builder from a config dictionary. Arguments: config: The config dictionary. envi...
python
wandb/sdk/launch/builder/abstract.py
40
59
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,096
build_image
def build_image( self, launch_project: LaunchProject, entrypoint: EntryPoint, ) -> str: """Build the image for the given project. Arguments: launch_project: The project to build. build_ctx_path: The path to the build context. Returns: ...
python
wandb/sdk/launch/builder/abstract.py
62
76
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,097
verify
def verify(self) -> None: """Verify that the builder can be used to build images. Raises: LaunchError: If the builder cannot be used to build images. """ raise NotImplementedError
python
wandb/sdk/launch/builder/abstract.py
79
85
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,098
validate_docker_installation
def validate_docker_installation() -> None: """Verify if Docker is installed on host machine.""" if not find_executable("docker"): raise ExecutionError( "Could not find Docker executable. " "Ensure Docker is installed as per the instructions " "at https://docs.docker....
python
wandb/sdk/launch/builder/build.py
50
57
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,099
get_docker_user
def get_docker_user(launch_project: LaunchProject, runner_type: str) -> Tuple[str, int]: import getpass username = getpass.getuser() if runner_type == "sagemaker" and not launch_project.docker_image: # unless user has provided their own image, sagemaker must run as root but keep the name for workd...
python
wandb/sdk/launch/builder/build.py
60
70
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,100
get_current_python_version
def get_current_python_version() -> Tuple[str, str]: full_version = sys.version.split()[0].split(".") major = full_version[0] version = ".".join(full_version[:2]) if len(full_version) >= 2 else major + ".0" return version, major
python
wandb/sdk/launch/builder/build.py
181
185
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }