本文整理汇总了Golang中github.com/pachyderm/pachyderm/src/pkg/uuid.NewWithoutDashes函数的典型用法代码示例。如果您正苦于以下问题:Golang NewWithoutDashes函数的具体用法?Golang NewWithoutDashes怎么用?Golang NewWithoutDashes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewWithoutDashes函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: setup
func (s *simpleTest) setup() {
if s.inputRepoName == "" {
s.inputRepoName = uuid.NewWithoutDashes()
}
if s.outputRepoName == "" {
s.outputRepoName = uuid.NewWithoutDashes()
}
if s.pipelineName == "" {
s.pipelineName = uuid.NewWithoutDashes()
}
if s.jobTimeoutSec == 0 {
s.jobTimeoutSec = defaultJobTimeoutSec
}
}
开发者ID:alexdebrie,项目名称:pachyderm,代码行数:14,代码来源:testing_test.go
示例2: StartCommit
func (a *apiServer) StartCommit(ctx context.Context, request *pfs.StartCommitRequest) (response *pfs.Commit, retErr error) {
defer func(start time.Time) { a.Log(request, response, retErr, time.Since(start)) }(time.Now())
a.versionLock.RLock()
defer a.versionLock.RUnlock()
ctx = versionToContext(a.version, ctx)
clientConns, err := a.router.GetAllClientConns(a.version)
if err != nil {
return nil, err
}
if request.Commit == nil {
if request.Parent == nil {
return nil, fmt.Errorf("one of Parent or Commit must be non nil")
}
request.Commit = &pfs.Commit{
Repo: request.Parent.Repo,
Id: uuid.NewWithoutDashes(),
}
}
for _, clientConn := range clientConns {
if _, err := pfs.NewInternalAPIClient(clientConn).StartCommit(ctx, request); err != nil {
return nil, err
}
}
return request.Commit, nil
}
开发者ID:klucar,项目名称:pachyderm,代码行数:25,代码来源:api_server.go
示例3: CreateJob
func (a *apiServer) CreateJob(ctx context.Context, request *pps.CreateJobRequest) (response *pps.Job, err error) {
defer func(start time.Time) { a.Log(request, response, err, time.Since(start)) }(time.Now())
persistJobInfo := &persist.JobInfo{
Input: request.Input,
OutputParent: request.OutputParent,
}
if request.GetTransform() != nil {
persistJobInfo.Spec = &persist.JobInfo_Transform{
Transform: request.GetTransform(),
}
} else if request.GetPipeline() != nil {
persistJobInfo.Spec = &persist.JobInfo_PipelineName{
PipelineName: request.GetPipeline().Name,
}
} else {
return nil, fmt.Errorf("pachyderm.pps.jobserver: both transform and pipeline are not set on %v", request)
}
persistJobInfo.JobId = uuid.NewWithoutDashes()
persistJobInfo.CreatedAt = prototime.TimeToTimestamp(time.Now())
if a.kubeClient == nil {
return nil, fmt.Errorf("pachyderm.pps.jobserver: no job backend")
}
if _, err := a.kubeClient.Jobs(api.NamespaceDefault).Create(job(persistJobInfo)); err != nil {
return nil, err
}
_, err = a.persistAPIClient.CreateJobInfo(ctx, persistJobInfo)
if err != nil {
return nil, err
}
return &pps.Job{
Id: persistJobInfo.JobId,
}, nil
}
开发者ID:alexdebrie,项目名称:pachyderm,代码行数:33,代码来源:api_server.go
示例4: runJobInfo
func (j *jobRunner) runJobInfo(persistJobInfo *persist.JobInfo) error {
switch {
case persistJobInfo.GetTransform() != nil:
return j.reallyRunJobInfo(
uuid.NewWithoutDashes(),
persistJobInfo.JobId,
persistJobInfo.GetTransform(),
persistJobInfo.Input,
persistJobInfo.OutputParent,
1,
)
case persistJobInfo.GetPipelineName() != "":
persistPipelineInfo, err := j.persistAPIClient.GetPipelineInfo(
context.Background(),
&pps.Pipeline{Name: persistJobInfo.GetPipelineName()},
)
if err != nil {
return err
}
if persistPipelineInfo.GetTransform() == nil {
return fmt.Errorf("pachyderm.pps.server: transform not set on pipeline info %v", persistPipelineInfo)
}
return j.reallyRunJobInfo(
persistPipelineInfo.PipelineName,
persistJobInfo.JobId,
persistPipelineInfo.GetTransform(),
persistJobInfo.Input,
persistJobInfo.OutputParent,
1,
)
default:
return fmt.Errorf("pachyderm.pps.server: neither transform or pipeline name set on job info %v", persistJobInfo)
}
}
开发者ID:mehulsbhatt,项目名称:pachyderm,代码行数:34,代码来源:job_runner.go
示例5: createDisks
func (a *apiServer) createDisks(ctx context.Context, nodes uint64) ([]string, error) {
var names []string
for i := uint64(0); i < nodes; i++ {
name := "disk-" + uuid.NewWithoutDashes()
if err := a.provider.CreateDisk(name, defaultDiskSizeGb); err != nil {
return nil, err
}
names = append(names, name)
}
return names, nil
}
开发者ID:alexdebrie,项目名称:pachyderm,代码行数:11,代码来源:api_server.go
示例6: NewTestRethinkAPIServer
func NewTestRethinkAPIServer() (server.APIServer, error) {
address, err := getTestRethinkAddress()
if err != nil {
return nil, err
}
databaseName := uuid.NewWithoutDashes()
if err := server.InitDBs(address, databaseName); err != nil {
return nil, err
}
return server.NewRethinkAPIServer(address, databaseName)
}
开发者ID:angelabier1,项目名称:pachyderm,代码行数:11,代码来源:testing.go
示例7: CreateJobInfo
// JobId cannot be set
// Timestamp cannot be set
func (a *rethinkAPIServer) CreateJobInfo(ctx context.Context, request *persist.JobInfo) (response *persist.JobInfo, err error) {
defer func(start time.Time) { a.Log(request, response, err, time.Since(start)) }(time.Now())
if request.JobId != "" {
return nil, fmt.Errorf("request.JobId should be unset")
}
if request.CreatedAt != nil {
return nil, fmt.Errorf("request.CreatedAt should be unset")
}
if request.CommitIndex != "" {
return nil, fmt.Errorf("request.CommitIndex should be unset")
}
request.JobId = uuid.NewWithoutDashes()
request.CreatedAt = prototime.TimeToTimestamp(time.Now())
request.CommitIndex = genCommitIndex(request.InputCommit)
if err := a.insertMessage(jobInfosTable, request); err != nil {
return nil, err
}
return request, nil
}
开发者ID:tjyang,项目名称:pachyderm,代码行数:21,代码来源:rethink_api_server.go
示例8: StartCommit
func (a *apiServer) StartCommit(ctx context.Context, request *pfs.StartCommitRequest) (*pfs.Commit, error) {
a.versionLock.RLock()
defer a.versionLock.RUnlock()
ctx = versionToContext(a.version, ctx)
clientConns, err := a.router.GetAllClientConns(a.version)
if err != nil {
return nil, err
}
if request.Commit == nil {
request.Commit = &pfs.Commit{
Repo: request.Parent.Repo,
Id: uuid.NewWithoutDashes(),
}
}
for _, clientConn := range clientConns {
if _, err := pfs.NewInternalAPIClient(clientConn).StartCommit(ctx, request); err != nil {
return nil, err
}
}
return request.Commit, nil
}
开发者ID:mehulsbhatt,项目名称:pachyderm,代码行数:21,代码来源:api_server.go
示例9: uniqueString
func uniqueString(prefix string) string {
return prefix + "." + uuid.NewWithoutDashes()[0:12]
}
开发者ID:angelabier1,项目名称:pachyderm,代码行数:3,代码来源:testing_test.go
示例10: NewLocalServer
func NewLocalServer() LocalServer {
return &localServer{
server: grpc.NewServer(),
path: filepath.Join("/tmp", uuid.NewWithoutDashes()),
}
}
开发者ID:angelabier1,项目名称:pachyderm,代码行数:6,代码来源:grpcutil.go
示例11: testBasicRethink
func testBasicRethink(t *testing.T, apiServer persist.APIServer) {
_, err := apiServer.CreatePipelineInfo(
context.Background(),
&persist.PipelineInfo{
PipelineName: "foo",
},
)
require.NoError(t, err)
pipelineInfo, err := apiServer.GetPipelineInfo(
context.Background(),
&pps.Pipeline{Name: "foo"},
)
require.NoError(t, err)
require.Equal(t, pipelineInfo.PipelineName, "foo")
inputCommits := []*pfs.Commit{pfsutil.NewCommit("bar", uuid.NewWithoutDashes())}
jobInfo, err := apiServer.CreateJobInfo(
context.Background(),
&persist.JobInfo{
PipelineName: "foo",
InputCommit: inputCommits,
},
)
jobID := jobInfo.JobId
inputCommits2 := []*pfs.Commit{pfsutil.NewCommit("fizz", uuid.NewWithoutDashes())}
_, err = apiServer.CreateJobInfo(
context.Background(),
&persist.JobInfo{
PipelineName: "buzz",
InputCommit: inputCommits2,
},
)
require.NoError(t, err)
jobInfo, err = apiServer.InspectJob(
context.Background(),
&pps.InspectJobRequest{
Job: &pps.Job{
Id: jobInfo.JobId,
},
},
)
require.NoError(t, err)
require.Equal(t, jobInfo.JobId, jobID)
require.Equal(t, "foo", jobInfo.PipelineName)
jobInfos, err := apiServer.ListJobInfos(
context.Background(),
&pps.ListJobRequest{
Pipeline: &pps.Pipeline{Name: "foo"},
},
)
require.NoError(t, err)
require.Equal(t, len(jobInfos.JobInfo), 1)
require.Equal(t, jobInfos.JobInfo[0].JobId, jobID)
jobInfos, err = apiServer.ListJobInfos(
context.Background(),
&pps.ListJobRequest{
InputCommit: inputCommits,
},
)
require.NoError(t, err)
require.Equal(t, len(jobInfos.JobInfo), 1)
require.Equal(t, jobInfos.JobInfo[0].JobId, jobID)
jobInfos, err = apiServer.ListJobInfos(
context.Background(),
&pps.ListJobRequest{
Pipeline: &pps.Pipeline{Name: "foo"},
InputCommit: inputCommits,
},
)
require.NoError(t, err)
require.Equal(t, len(jobInfos.JobInfo), 1)
require.Equal(t, jobInfos.JobInfo[0].JobId, jobID)
}
开发者ID:angelabier1,项目名称:pachyderm,代码行数:72,代码来源:rethink_api_server_test.go
示例12: CreateInDir
func (c *mockClient) CreateInDir(dir string, value string, ttl uint64) error {
c.lock.Lock()
defer c.lock.Unlock()
key := path.Join(dir, uuid.NewWithoutDashes())
return c.unsafeSet(key, value, ttl)
}
开发者ID:angelabier1,项目名称:pachyderm,代码行数:6,代码来源:mock_client.go
注:本文中的github.com/pachyderm/pachyderm/src/pkg/uuid.NewWithoutDashes函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论