GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — cortex/src/cortex/challenges/__main__.py at main · CortexLM/cortex

Expand file tree

/

__main__.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
59 lines (47 loc) · 1.93 KB
/

__main__.py

Copy path

File metadata and controls

59 lines (47 loc) · 1.93 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""`cortex challenge-supervisor`: the only Cortex process that controls Docker."""
from __future__ import annotations
import argparse
import asyncio
import logging
from pathlib import Path
import httpx
from .supervisor import Supervisor, SupervisorConfig
def parser() -> argparse.ArgumentParser:
arguments = argparse.ArgumentParser(description="Run and auto-update challenge containers")
arguments.add_argument("--registry", type=Path, required=True)
arguments.add_argument(
"--secrets-host-dir",
type=Path,
required=True,
help="absolute HOST path holding <challenge id>/{internal.token,admin.token,...}",
)
arguments.add_argument("--docker-socket", default="/var/run/docker.sock")
arguments.add_argument("--network", default="cortex-challenges")
arguments.add_argument("--master-url", default="http://cortex-master:8080")
arguments.add_argument("--once", action="store_true", help="reconcile every entry once")
return arguments
async def run(arguments: argparse.Namespace) -> None:
config = SupervisorConfig(
registry_file=arguments.registry,
secrets_host_dir=arguments.secrets_host_dir,
network=arguments.network,
master_url=arguments.master_url,
)
transport = httpx.AsyncHTTPTransport(uds=arguments.docker_socket)
async with (
httpx.AsyncClient(transport=transport, base_url="http://docker/v1.44") as docker,
httpx.AsyncClient(trust_env=False, follow_redirects=False) as http,
):
supervisor = Supervisor(config, docker, http)
if arguments.once:
await supervisor.tick(float("inf"))
return
await supervisor.run()
def main(argv: list[str] | None = None) -> None:
logging.basicConfig(level=logging.INFO, format="%(levelname)s %(message)s")
try:
asyncio.run(run(parser().parse_args(argv)))
except KeyboardInterrupt:
pass
if __name__ == "__main__":
main()
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.