def upload_model_to_nexus(project):
"""
Use 'pyb -P model_name="<model_name>" upload_model_to_nexus' to upload archived model to Nexus repository
of the lab. If model_name == 'deeppavlov_docs', then documentation from build/docs will be archived and uploaded.
archive_model task will be executed before.
"""
import requests, datetime
os.chdir('build')
model_name = project.get_property('model_name')
file_name = model_name + '_' + datetime.date.today().strftime("%y%m%d") + '.tar.gz'
url = 'http://share.ipavlov.mipt.ru:8080/repository/'
url += 'docs/' if model_name == 'deeppavlov_docs' else 'models/'
headers = {'Content-Type': 'application/binary'}
with open(file_name, 'rb') as artifact:
requests.put(url + model_name + '/' + file_name, headers=headers,
data=artifact, auth=('jenkins', 'jenkins123'))
评论列表
文章目录