You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a proper logging system instead of using print statements. Reference the following files:
def_check_environment() ->bool:
"""Verify the execution environment is valid. Checks: - Current directory is within configured workspace - Docker is running - tiny42 container exists and is running Returns: bool: True if environment is valid, False otherwise """current_path: str=os.getcwd()
# Check if current path is within workspaceifnotcurrent_path.startswith(TINY42_WORKSPACE):
print(f"{TINY42_RED}You are not inside the workspace specified.{TINY42_WHITE}")
print(f"{TINY42_BLUE}tiny42 can only be ran inside the specified workspace, "f"currently it is set to \"{TINY42_WORKSPACE}\".{TINY42_WHITE}")
returnFalse# Check if tiny42 container is runningtry:
output: str=subprocess.check_output(['docker', 'ps'], text=True)
if'tiny42'notinoutput:
# Check if image existsimages: str=subprocess.check_output(['docker', 'images'], text=True)
if'tiny42'notinimages:
init_tiny42()
else:
run_cmd: List[str] = ['docker', 'run', '-itd']
port_mapping: Optional[str] =get_port_mapping()
ifport_mapping:
run_cmd.append(port_mapping)
run_cmd.extend([
'-v', f'{TINY42_WORKSPACE}:/tiny42_workspace',
'--name=tiny42', 'tiny42'
])
subprocess.run(run_cmd)
exceptsubprocess.CalledProcessError:
returnFalsereturnTrue
Add a proper logging system instead of using print statements. Reference the following files:
Replace print statements with a logging system:
The text was updated successfully, but these errors were encountered: