File tree Expand file tree Collapse file tree 3 files changed +16
-10
lines changed Expand file tree Collapse file tree 3 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ dataset = ["pandas", "numpy"]
26
26
torch = [" torch" ]
27
27
plot = [" matplotlib" , " plotly" ]
28
28
29
+ [tool .poetry .scripts ]
30
+ simvue_sender = " simvue.bin.simvue_sender:run"
31
+
29
32
[build-system ]
30
33
requires = [" poetry-core" ]
31
34
build-backend = " poetry.core.masonry.api"
Original file line number Diff line number Diff line change 1
1
"""Send runs to server"""
2
- #!/usr/bin/env python
3
2
import getpass
4
3
import os
5
4
import logging
6
5
import sys
6
+ import tempfile
7
7
8
8
from simvue .sender import sender
9
9
from simvue .utilities import create_file , remove_file
17
17
handler .setFormatter (formatter )
18
18
logger .addHandler (handler )
19
19
20
- if __name__ == "__main__":
21
- lockfile = f"/tmp/simvue-{getpass.getuser()}.lock"
22
- if not os.path.isfile(lockfile):
23
- create_file(lockfile)
20
+ def run () -> None :
21
+ lockfile = os .path .join (tempfile .gettempdir (), f"simvue-{ getpass .getuser ()} .lock" )
22
+
23
+ if os .path .isfile (lockfile ):
24
+ logger .error ("Cannot initiate run, locked by other process." )
25
+ sys .exit (1 )
24
26
25
- try:
26
- sender()
27
- except Exception as err:
28
- logger.critical('Exception running sender: %s', str(err))
27
+ create_file (lockfile )
28
+ try :
29
+ sender ()
30
+ except Exception as err :
31
+ logger .critical ('Exception running sender: %s' , str (err ))
29
32
30
- remove_file(lockfile)
33
+ remove_file (lockfile )
You can’t perform that action at this time.
0 commit comments