Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pycomsdk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
com
pycomsdk
Commits
403a61a7
Commit
403a61a7
authored
Jun 30, 2022
by
Anton Pershin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added mkdir function to edge
parent
dfe773fb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
communication.py
comsdk/communication.py
+1
-0
edge.py
comsdk/edge.py
+19
-4
No files found.
comsdk/communication.py
View file @
403a61a7
...
@@ -309,6 +309,7 @@ class SshCommunication(BaseCommunication):
...
@@ -309,6 +309,7 @@ class SshCommunication(BaseCommunication):
def
_chdir
(
self
,
path
=
None
):
def
_chdir
(
self
,
path
=
None
):
self
.
sftp_client
.
chdir
(
path
)
self
.
sftp_client
.
chdir
(
path
)
@enable_sftp
def
_mkdirp
(
self
,
path
):
def
_mkdirp
(
self
,
path
):
path_list
=
path
.
split
(
'/'
)
path_list
=
path
.
split
(
'/'
)
cur_dir
=
''
cur_dir
=
''
...
...
comsdk/edge.py
View file @
403a61a7
...
@@ -54,7 +54,7 @@ class Edge:
...
@@ -54,7 +54,7 @@ class Edge:
'order'
,
'order'
,
'comment'
,
'comment'
,
'mandatory_keys'
,
'mandatory_keys'
,
'use_proxy_data'
'use_proxy_data
_for_pre_post_processing
'
]
]
def
__init__
(
self
,
predicate
,
morphism
,
def
__init__
(
self
,
predicate
,
morphism
,
...
@@ -71,7 +71,7 @@ class Edge:
...
@@ -71,7 +71,7 @@ class Edge:
self
.
order
=
int
(
0
if
order
is
None
else
order
)
self
.
order
=
int
(
0
if
order
is
None
else
order
)
self
.
comment
=
comment
self
.
comment
=
comment
self
.
mandatory_keys
=
mandatory_keys
self
.
mandatory_keys
=
mandatory_keys
self
.
use_proxy_data
=
False
self
.
use_proxy_data
_for_pre_post_processing
=
False
def
predicate
(
self
,
data
,
dynamic_keys_mapping
=
{}):
def
predicate
(
self
,
data
,
dynamic_keys_mapping
=
{}):
proxy_data
=
self
.
_io_mapping
.
build_proxy_data
(
data
,
dynamic_keys_mapping
)
proxy_data
=
self
.
_io_mapping
.
build_proxy_data
(
data
,
dynamic_keys_mapping
)
...
@@ -81,13 +81,13 @@ class Edge:
...
@@ -81,13 +81,13 @@ class Edge:
#print(self.pred_name, self.morph_name, self.order)
#print(self.pred_name, self.morph_name, self.order)
proxy_data
=
self
.
_io_mapping
.
build_proxy_data
(
data
,
dynamic_keys_mapping
)
proxy_data
=
self
.
_io_mapping
.
build_proxy_data
(
data
,
dynamic_keys_mapping
)
# print(proxy_data)
# print(proxy_data)
if
(
self
.
use_proxy_data
):
if
(
self
.
use_proxy_data
_for_pre_post_processing
):
self
.
preprocess
(
proxy_data
)
self
.
preprocess
(
proxy_data
)
else
:
else
:
self
.
preprocess
(
data
)
self
.
preprocess
(
data
)
self
.
_throw_if_not_set
(
proxy_data
,
self
.
mandatory_keys
)
self
.
_throw_if_not_set
(
proxy_data
,
self
.
mandatory_keys
)
self
.
morph_f
.
func
(
proxy_data
)
self
.
morph_f
.
func
(
proxy_data
)
if
(
self
.
use_proxy_data
):
if
(
self
.
use_proxy_data
_for_pre_post_processing
):
self
.
postprocess
(
proxy_data
)
self
.
postprocess
(
proxy_data
)
else
:
else
:
self
.
postprocess
(
data
)
self
.
postprocess
(
data
)
...
@@ -299,6 +299,8 @@ class DownloadFromRemoteEdge(Edge):
...
@@ -299,6 +299,8 @@ class DownloadFromRemoteEdge(Edge):
remote_working_dir
=
data
[
'__REMOTE_WORKING_DIR__'
]
remote_working_dir
=
data
[
'__REMOTE_WORKING_DIR__'
]
for
key
in
self
.
_remote_paths_keys
:
for
key
in
self
.
_remote_paths_keys
:
output_file_or_dir
=
data
[
key
]
output_file_or_dir
=
data
[
key
]
if
output_file_or_dir
is
None
:
continue
local_path
=
None
local_path
=
None
if
output_file_or_dir
==
'*'
:
if
output_file_or_dir
==
'*'
:
aux
.
print_msg_if_allowed
(
'
\t
All possible output files will be downloaded'
,
allow
=
self
.
_show_msg
)
aux
.
print_msg_if_allowed
(
'
\t
All possible output files will be downloaded'
,
allow
=
self
.
_show_msg
)
...
@@ -340,6 +342,19 @@ def make_cd(key_path):
...
@@ -340,6 +342,19 @@ def make_cd(key_path):
return
_cd
return
_cd
def
make_mkdir
(
key_path
,
remote_comm
=
None
):
def
_mkdir
(
d
):
remote
=
'__REMOTE_WORKING_DIR__'
in
d
dir
=
os
.
path
.
join
(
d
[
'__WORKING_DIR__'
],
d
[
key_path
])
os
.
mkdir
(
dir
)
if
'__REMOTE_WORKING_DIR__'
in
d
:
dir
=
os
.
path
.
join
(
d
[
'__REMOTE_WORKING_DIR__'
],
d
[
key_path
])
remote_comm
.
_mkdirp
(
dir
)
return
_mkdir
def
make_dump
(
dump_name_format
,
format_keys
=
(),
omit
=
None
,
method
=
'pickle'
):
def
make_dump
(
dump_name_format
,
format_keys
=
(),
omit
=
None
,
method
=
'pickle'
):
def
_dump
(
d
):
def
_dump
(
d
):
format_params
=
[
aux
.
recursive_get
(
d
,
key
)
for
key
in
format_keys
]
format_params
=
[
aux
.
recursive_get
(
d
,
key
)
for
key
in
format_keys
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment