scope 0.4.0__tar.gz → 0.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: scope
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: Metrics logging and analysis
5
5
  Home-page: http://github.com/danijar/scope
6
6
  Classifier: Intended Audience :: Science/Research
@@ -1,5 +1,5 @@
1
1
  av
2
- elements>=3.15.11
2
+ elements>=3.16.6
3
3
  fastapi
4
4
  numpy
5
5
  pillow
@@ -1,4 +1,4 @@
1
- __version__ = '0.4.0'
1
+ __version__ = '0.4.1'
2
2
 
3
3
  from .reader import Reader
4
4
  from .writer import Writer
@@ -0,0 +1,20 @@
1
+ import pathlib
2
+ import sys
3
+
4
+ import uvicorn
5
+ from . import config
6
+
7
+
8
+ config = config.config
9
+
10
+ print(config)
11
+
12
+ sys.path.insert(0, str(pathlib.Path(__file__).parent))
13
+
14
+ uvicorn.run(
15
+ 'server:app',
16
+ host='0.0.0.0',
17
+ port=config.port,
18
+ reload=config.debug,
19
+ workers=None if config.debug else config.workers,
20
+ )
@@ -0,0 +1,15 @@
1
+ import os
2
+
3
+ import elements
4
+
5
+
6
+ config = elements.Flags(
7
+ port=int(os.environ.get('SCOPE_PORT', 8000)),
8
+ basedir=os.environ.get('SCOPE_BASEDIR', ''),
9
+ filesystem=os.environ.get('SCOPE_FILESYSTEM', 'elements'),
10
+ maxdepth=2,
11
+ workers=32,
12
+ debug=False,
13
+ ).parse()
14
+
15
+ assert config.basedir, config.basedir
@@ -1,36 +1,24 @@
1
1
  import concurrent.futures
2
2
  import functools
3
- import os
4
3
  import pathlib
5
4
  import struct
6
5
 
7
- import elements
8
6
  import fastapi
9
7
  import fastapi.responses
10
8
  import fastapi.staticfiles
11
9
 
12
10
  import filesystems
11
+ import config
13
12
 
14
13
 
15
- args = elements.Flags(
16
- basedir=os.environ.get('SCOPE_ROOT', ''),
17
- fs=os.environ.get('SCOPE_FS', 'elements'),
18
- maxdepth=2,
19
- debug=False,
20
- ).parse()
21
- print(args)
22
- assert args.basedir, args.basedir
23
- basedir = args.basedir.rstrip('/')
24
-
25
-
14
+ config = config.config
15
+ app = fastapi.FastAPI(debug=config.debug)
16
+ basedir = config.basedir.rstrip('/')
26
17
  fs = dict(
27
18
  elements=filesystems.Elements,
28
19
  fileutil=filesystems.Fileutil,
29
20
  local=filesystems.Local,
30
- )[args.fs]()
31
-
32
-
33
- app = fastapi.FastAPI(debug=args.debug)
21
+ )[config.filesystem]()
34
22
 
35
23
 
36
24
  @app.get('/api/exps')
@@ -101,7 +89,7 @@ dist = pathlib.Path(__file__).parent / 'dist'
101
89
  app.mount('/', fastapi.staticfiles.StaticFiles(directory=dist, html=True))
102
90
 
103
91
 
104
- def find_runs(folder, maxdepth=args.maxdepth, workers=64):
92
+ def find_runs(folder, maxdepth=config.maxdepth, workers=64):
105
93
  if not workers:
106
94
  runs = []
107
95
  queue = [(folder, 0)]
@@ -1,24 +0,0 @@
1
- import os
2
- import pathlib
3
- import sys
4
-
5
- import elements
6
- import uvicorn
7
-
8
-
9
- args, sys.argv[1:] = elements.Flags(
10
- port=int(os.environ.get('SCOPE_SERVER_PORT', 8000)),
11
- workers=32,
12
- debug=False,
13
- ).parse_known()
14
-
15
- sys.argv.append(f'--debug={args.debug}')
16
- sys.path.insert(0, str(pathlib.Path(__file__).parent))
17
-
18
- uvicorn.run(
19
- 'server:app',
20
- host='0.0.0.0',
21
- port=args.port,
22
- reload=args.debug,
23
- workers=None if args.debug else args.workers,
24
- )
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes