/
sftp_example.py
executable file
·63 lines (55 loc) · 2.02 KB
/
sftp_example.py
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
60
61
62
63
#!/usr/bin/env python
from joblib.disk import mkdirp
import provenance as p
mkdirp('./remote-machine/sftp-artifacts')
p.load_config(
{
'blobstores':
{
'sftp':
{
'type':
'sftp',
'cachedir':
'<This is the path on your local machine where you want the blobs to be cached, ex. /Users/me/provenance/examples/sftp/artifacts>',
'basepath':
'< "" remote machine "" , ex. /home/me/artifacts>, you need to make sure that path directory exists.',
'read':
True,
'write':
True,
'read_through_write':
False,
'delete':
True,
'ssh_config':
{
'hostname': '<your host here>',
'port': '<your port here as an int, defaults to 22 if excluded>',
'username': '<your user here>',
'password': '<your password here>',
},
}
},
'artifact_repos':
{
'local':
{
'type': 'postgres',
'db': 'postgresql://localhost/provenance-sftp-example',
'store': 'sftp',
'read': True,
'write': True,
'create_db': True,
'read_through_write': False,
'delete': True,
}
},
'default_repo': 'local',
}
)
@p.provenance()
def my_add(x, y):
print('Executed')
return x + y
print(my_add(1, 4))