Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
lmp_server
Project
Project
Details
Activity
Releases
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
lmp
lmp_server
Commits
3a33c233
Commit
3a33c233
authored
Dec 11, 2023
by
linpeiqin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
先生成压缩任务,然后压缩成功之后再同步状态,同时修改一些存值的小bug
parent
f45e3ad5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
40 deletions
+50
-40
ModelCompressMapper.xml
.../com/yice/webadmin/app/dao/mapper/ModelCompressMapper.xml
+6
-6
ModelCompressServiceImpl.java
...e/webadmin/app/service/impl/ModelCompressServiceImpl.java
+41
-33
ModelVersionServiceImpl.java
...ce/webadmin/app/service/impl/ModelVersionServiceImpl.java
+3
-1
No files found.
application-webadmin/src/main/java/com/yice/webadmin/app/dao/mapper/ModelCompressMapper.xml
View file @
3a33c233
...
...
@@ -9,9 +9,9 @@
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"task_name"
jdbcType=
"VARCHAR"
property=
"taskName"
/>
<result
column=
"task_describe"
jdbcType=
"VARCHAR"
property=
"taskDescribe"
/>
<result
column=
"source_
model_id"
jdbcType=
"BIGINT"
property=
"sourceModel
Id"
/>
<result
column=
"source_
version_id"
jdbcType=
"BIGINT"
property=
"sourceVersion
Id"
/>
<result
column=
"create_method"
jdbcType=
"TINYINT"
property=
"createMethod"
/>
<result
column=
"target_
model_id"
jdbcType=
"BIGINT"
property=
"targetModel
Id"
/>
<result
column=
"target_
version_id"
jdbcType=
"BIGINT"
property=
"targetVersion
Id"
/>
</resultMap>
<insert
id=
"insertList"
>
...
...
@@ -23,9 +23,9 @@
update_time,
task_name,
task_describe,
source_
model
_id,
source_
version
_id,
create_method,
target_
model
_id)
target_
version
_id)
VALUES
<foreach
collection=
"list"
index=
"index"
item=
"item"
separator=
","
>
(#{item.taskId},
...
...
@@ -35,9 +35,9 @@
#{item.updateTime},
#{item.taskName},
#{item.taskDescribe},
#{item.source
Model
Id},
#{item.source
Version
Id},
#{item.createMethod},
#{item.target
Model
Id})
#{item.target
Version
Id})
</foreach>
</insert>
...
...
application-webadmin/src/main/java/com/yice/webadmin/app/service/impl/ModelCompressServiceImpl.java
View file @
3a33c233
...
...
@@ -14,8 +14,10 @@ import com.yice.common.core.util.MyModelUtil;
import
com.yice.common.sequence.wrapper.IdGeneratorWrapper
;
import
com.yice.webadmin.app.config.PythonConfig
;
import
com.yice.webadmin.app.dao.ModelCompressMapper
;
import
com.yice.webadmin.app.dto.RunPublishDto
;
import
com.yice.webadmin.app.model.*
;
import
com.yice.webadmin.app.model.ModelCompress
;
import
com.yice.webadmin.app.model.ModelManage
;
import
com.yice.webadmin.app.model.ModelTask
;
import
com.yice.webadmin.app.model.ModelVersion
;
import
com.yice.webadmin.app.service.ModelCompressService
;
import
com.yice.webadmin.app.service.ModelManageService
;
import
com.yice.webadmin.app.service.ModelTaskService
;
...
...
@@ -30,10 +32,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
java.util.List
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicLong
;
/**
* 模型压缩数据操作服务类。
...
...
@@ -59,7 +58,6 @@ public class ModelCompressServiceImpl extends BaseService<ModelCompress, Long> i
private
PythonConfig
pythonConfig
;
/**
* 返回当前Service的主表Mapper对象。
*
...
...
@@ -101,7 +99,7 @@ public class ModelCompressServiceImpl extends BaseService<ModelCompress, Long> i
@SneakyThrows
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
ModelCompress
saveNewWithRelation
(
ModelCompress
modelCompress
,
JSONObject
relationData
){
public
ModelCompress
saveNewWithRelation
(
ModelCompress
modelCompress
,
JSONObject
relationData
)
{
String
targetModelVersionURl
;
Long
taskId
=
idGenerator
.
nextLongId
();
Long
userID
=
TokenData
.
takeFromRequest
().
getUserId
();
...
...
@@ -123,6 +121,7 @@ public class ModelCompressServiceImpl extends BaseService<ModelCompress, Long> i
public
void
onOpen
(
ServerHandshake
serverHandshake
)
{
log
.
info
(
"-------------与大模型建立连接-------------"
);
}
@Override
public
void
onMessage
(
String
message
)
{
log
.
info
(
"收到来自服务端的消息:"
+
message
);
...
...
@@ -134,6 +133,11 @@ public class ModelCompressServiceImpl extends BaseService<ModelCompress, Long> i
sendJson
.
put
(
"session_hash"
,
String
.
valueOf
(
taskId
));
log
.
info
(
"发送服务端的消息:"
+
sendJson
.
toJSONString
());
this
.
send
(
sendJson
.
toJSONString
());
modelCompress
.
setCreateUserId
(
userID
);
modelCompress
.
setUpdateUserId
(
userID
);
modelCompress
.
setTaskStatus
(
3
);
saveNew
(
modelCompress
);
saveOrUpdateOneToOneRelationData
(
modelCompress
,
relationData
,
userID
);
}
else
if
(
receiveMsg
.
equals
(
"send_data"
))
{
JSONArray
array
=
new
JSONArray
();
array
.
add
(
"zh"
);
...
...
@@ -152,15 +156,15 @@ public class ModelCompressServiceImpl extends BaseService<ModelCompress, Long> i
log
.
info
(
"发送服务端的消息:"
+
sendJson
.
toJSONString
());
this
.
send
(
sendJson
.
toJSONString
());
}
else
if
(
receiveMsg
.
equals
(
"process_completed"
))
{
if
(
receiveJson
.
getBoolean
(
"success"
)){
saveAll
(
modelCompress
,
relationData
,
targetModelVersionURl
,
userID
);
}
saveAll
(
receiveJson
.
getBoolean
(
"success"
),
modelCompress
,
targetModelVersionURl
,
userID
);
}
}
@Override
public
void
onClose
(
int
i
,
String
s
,
boolean
b
)
{
log
.
info
(
"关闭连接:::"
+
"i = "
+
i
+
":::s = "
+
s
+
":::b = "
+
b
);
}
@Override
public
void
onError
(
Exception
e
)
{
log
.
error
(
"报错了:::"
+
e
.
getMessage
());
...
...
@@ -170,31 +174,35 @@ public class ModelCompressServiceImpl extends BaseService<ModelCompress, Long> i
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
synchronized
void
saveAll
(
ModelCompress
modelCompress
,
JSONObject
relationData
,
String
targetModelVersionURl
,
Long
userID
)
{
public
synchronized
void
saveAll
(
Boolean
flag
,
ModelCompress
modelCompress
,
String
targetModelVersionURl
,
Long
userID
)
{
ModelVersion
modelVersionS
=
new
ModelVersion
();
modelVersionS
.
setTaskId
(
modelCompress
.
getTaskId
());
modelVersionS
.
setIsCompress
(
1
);
modelVersionS
.
setModelUrl
(
targetModelVersionURl
);
modelVersionS
.
setCreateUserId
(
userID
);
modelVersionS
.
setUpdateUserId
(
userID
);
modelCompress
.
setCreateUserId
(
userID
);
modelCompress
.
setUpdateUserId
(
userID
);
saveNew
(
modelCompress
);
saveOrUpdateOneToOneRelationData
(
modelCompress
,
relationData
,
userID
);
if
(
modelCompress
.
getCreateMethod
()
==
0
)
{
modelVersionS
.
setModelId
(
modelCompress
.
getTargetModelId
());
modelVersionService
.
saveNew
(
modelVersionS
);
if
(
flag
)
{
modelVersionS
.
setTaskId
(
modelCompress
.
getTaskId
());
modelVersionS
.
setIsCompress
(
1
);
modelVersionS
.
setModelUrl
(
targetModelVersionURl
);
modelVersionS
.
setCreateUserId
(
userID
);
modelVersionS
.
setUpdateUserId
(
userID
);
if
(
modelCompress
.
getCreateMethod
()
==
0
)
{
modelVersionS
.
setModelId
(
modelCompress
.
getTargetModelId
());
modelVersionService
.
saveNew
(
modelVersionS
);
}
else
{
ModelManage
modelManageS
=
new
ModelManage
();
modelManageS
.
setCreateUserId
(
userID
);
modelManageS
.
setUpdateUserId
(
userID
);
modelManageS
.
setModelName
(
modelCompress
.
getTargetModelName
());
modelManageS
.
setModelDescribe
(
modelCompress
.
getTaskDescribe
());
modelManageS
.
setModelType
(
0
);
modelManageS
.
setIsBaseModel
(
0
);
modelManageService
.
saveAndCreateVersion
(
modelManageS
,
modelVersionS
);
}
modelCompress
.
setTaskStatus
(
1
);
modelCompress
.
setTargetVersionId
(
modelVersionS
.
getVersionId
());
}
else
{
ModelManage
modelManageS
=
new
ModelManage
();
modelManageS
.
setCreateUserId
(
userID
);
modelManageS
.
setUpdateUserId
(
userID
);
modelManageS
.
setModelName
(
modelCompress
.
getTargetModelName
());
modelManageS
.
setModelDescribe
(
modelCompress
.
getTaskDescribe
());
modelManageS
.
setModelType
(
0
);
modelManageS
.
setIsBaseModel
(
0
);
modelManageService
.
saveAndCreateVersion
(
modelManageS
,
modelVersionS
);
modelCompress
.
setTaskStatus
(-
1
);
}
updateById
(
modelCompress
);
}
/**
* 更新数据对象。
*
...
...
@@ -219,11 +227,11 @@ public class ModelCompressServiceImpl extends BaseService<ModelCompress, Long> i
if
(
modelCompress
!=
null
&&
!
this
.
update
(
modelCompress
,
originalModelCompress
))
{
return
false
;
}
this
.
saveOrUpdateOneToOneRelationData
(
originalModelCompress
,
relationData
,
TokenData
.
takeFromRequest
().
getUserId
());
this
.
saveOrUpdateOneToOneRelationData
(
originalModelCompress
,
relationData
,
TokenData
.
takeFromRequest
().
getUserId
());
return
true
;
}
private
void
saveOrUpdateOneToOneRelationData
(
ModelCompress
modelCompress
,
JSONObject
relationData
,
Long
userId
)
{
private
void
saveOrUpdateOneToOneRelationData
(
ModelCompress
modelCompress
,
JSONObject
relationData
,
Long
userId
)
{
// 对于一对一新增或更新,如果主键值为空就新增,否则就更新,同时更新updateTime和updateUserId。
ModelTask
modelTask
=
relationData
.
getObject
(
"modelTask"
,
ModelTask
.
class
);
if
(
modelTask
!=
null
)
{
...
...
application-webadmin/src/main/java/com/yice/webadmin/app/service/impl/ModelVersionServiceImpl.java
View file @
3a33c233
...
...
@@ -72,7 +72,9 @@ public class ModelVersionServiceImpl extends BaseService<ModelVersion, Long> imp
version
=
modelVersionList
.
get
(
modelVersionList
.
size
()
-
1
).
getModelVersion
()
+
1
;
}
modelVersion
.
setModelVersion
(
version
);
modelVersion
.
setIsCompress
(
0
);
if
(
modelVersion
.
getIsCompress
()
==
null
)
{
modelVersion
.
setIsCompress
(
0
);
}
modelVersion
.
setVersionName
(
modelName
+
"_V"
+
modelVersion
.
getModelVersion
());
modelVersionMapper
.
insert
(
this
.
buildDefaultValue
(
modelVersion
));
//此处应该调用精调运行发布的方法生成模型任务,不应该直接生成!!!!!!!!!!!!!!!!!
...
...
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