Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
workspaces
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ssa
workspaces
Commits
5a818535
Commit
5a818535
authored
4 years ago
by
Nathan Hertz
Browse files
Options
Downloads
Patches
Plain Diff
Added some error checking and comments.
parent
70f1949c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
recipes/build_pkgs/build_pkgs.py
+4
-3
4 additions, 3 deletions
recipes/build_pkgs/build_pkgs.py
tools/transfer_to_builder.py
+11
-6
11 additions, 6 deletions
tools/transfer_to_builder.py
with
15 additions
and
9 deletions
recipes/build_pkgs/build_pkgs.py
+
4
−
3
View file @
5a818535
import
subprocess
,
os
,
glob
import
subprocess
def
get_pkg_list
():
"""
...
...
@@ -22,6 +22,7 @@ class Recipe:
:param name: (Boilerplate) Name of section that uses this recipe.
:param options: (Boilerplate) Options of section that uses this recipe.
"""
self
.
name
=
name
self
.
options
=
options
self
.
pkg_list
=
get_pkg_list
()
...
...
@@ -30,10 +31,10 @@ class Recipe:
Install method that runs when recipe has components it needs to install.
:return: Paths to files, as strings, created by the recipe.
"""
if
self
.
options
[
'
name
'
]
==
"
all
"
:
if
self
.
name
==
"
all
"
:
pkgs
=
self
.
pkg_list
else
:
pkgs
=
self
.
options
[
'
name
'
]
.
split
(
'
,
'
)
pkgs
=
self
.
name
.
split
(
'
,
'
)
for
p
in
pkgs
:
if
p
not
in
self
.
pkg_list
:
...
...
This diff is collapsed.
Click to expand it.
tools/transfer_to_builder.py
+
11
−
6
View file @
5a818535
...
...
@@ -15,6 +15,11 @@ def get_build_pkg_names():
return
pkg_names
def
create_ssh_client
(
server
):
"""
Use paramiko to load SSH keys if they exist and set up an SSH connection to a server.
:param server: The server to connect to
:return: Initialized SSH client object.
"""
client
=
paramiko
.
SSHClient
()
client
.
load_system_host_keys
()
client
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
...
...
@@ -24,13 +29,14 @@ def create_ssh_client(server):
def
transfer_packages
(
pkg_names
):
"""
Use shell commands to transfer build archives to builder and update its conda package index.
:param pkg_names: Names of the .tar.bz2 files for the built packages.
"""
builder_addr
=
"
builder.aoc.nrao.edu
"
builder_path
=
"
/home/builder.aoc.nrao.edu/content/conda/noarch
"
ssh
=
create_ssh_client
(
builder_addr
)
scp
=
SCPClient
(
ssh
.
get_transport
())
if
len
(
pkg_names
):
scp
.
put
(
'
'
.
join
(
pkg_names
),
builder_path
)
builder_addr
=
"
builder.aoc.nrao.edu
"
builder_path
=
"
/home/builder.aoc.nrao.edu/content/conda/noarch
"
ssh
=
create_ssh_client
(
builder_addr
)
with
SCPClient
(
ssh
.
get_transport
())
as
scp
:
[
scp
.
put
(
pkg
,
builder_path
)
for
pkg
in
pkg_names
]
cmd_cd
=
"
cd {}
"
.
format
(
builder_path
)
cmd_index
=
"
conda index ..
"
cmd_chmod
=
"
chmod -f 664 *
"
...
...
@@ -40,7 +46,6 @@ def transfer_packages(pkg_names):
cmd_chmod
])
else
:
print
(
"
No packages found in pkgs/noarch. Did conda build successfully build the package(s)?
"
)
return
if
__name__
==
"
__main__
"
:
transfer_packages
(
get_build_pkg_names
())
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment