_id stringlengths 2 7 | title stringlengths 1 118 | partition stringclasses 3
values | text stringlengths 52 85.5k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q177300 | cephRBDVolumeRename | test | func cephRBDVolumeRename(clusterName string, poolName string, volumeType string,
oldVolumeName string, newVolumeName string, userName string) error {
_, err := shared.RunCommand(
"rbd",
"--id", userName,
"--cluster", clusterName,
"mv",
fmt.Sprintf("%s/%s_%s", poolName, volumeType, oldVolumeName),
fmt.Spri... | go | {
"resource": ""
} |
q177301 | cephRBDVolumeSnapshotRename | test | func cephRBDVolumeSnapshotRename(clusterName string, poolName string,
volumeName string, volumeType string, oldSnapshotName string,
newSnapshotName string, userName string) error {
_, err := shared.RunCommand(
"rbd",
"--id", userName,
"--cluster", clusterName,
"snap",
"rename",
fmt.Sprintf("%s/%s_%s@%s",... | go | {
"resource": ""
} |
q177302 | cephRBDSnapshotDelete | test | func cephRBDSnapshotDelete(clusterName string, poolName string,
volumeName string, volumeType string, snapshotName string,
userName string) error {
_, err := shared.RunCommand(
"rbd",
"--id", userName,
"--cluster", clusterName,
"--pool", poolName,
"snap",
"rm",
fmt.Sprintf("%s_%s@%s", volumeType, volum... | go | {
"resource": ""
} |
q177303 | cephRBDVolumeCopy | test | func cephRBDVolumeCopy(clusterName string, oldVolumeName string,
newVolumeName string, userName string) error {
_, err := shared.RunCommand(
"rbd",
"--id", userName,
"--cluster", clusterName,
"cp",
oldVolumeName,
newVolumeName)
if err != nil {
return err
}
return nil
} | go | {
"resource": ""
} |
q177304 | cephRBDVolumeListSnapshots | test | func cephRBDVolumeListSnapshots(clusterName string, poolName string,
volumeName string, volumeType string,
userName string) ([]string, error) {
msg, err := shared.RunCommand(
"rbd",
"--id", userName,
"--format", "json",
"--cluster", clusterName,
"--pool", poolName,
"snap",
"ls", fmt.Sprintf("%s_%s", vo... | go | {
"resource": ""
} |
q177305 | getRBDSize | test | func (s *storageCeph) getRBDSize() (string, error) {
sz, err := shared.ParseByteSizeString(s.volume.Config["size"])
if err != nil {
return "", err
}
// Safety net: Set to default value.
if sz == 0 {
sz, _ = shared.ParseByteSizeString("10GB")
}
return fmt.Sprintf("%dB", sz), nil
} | go | {
"resource": ""
} |
q177306 | getRBDFilesystem | test | func (s *storageCeph) getRBDFilesystem() string {
if s.volume.Config["block.filesystem"] != "" {
return s.volume.Config["block.filesystem"]
}
if s.pool.Config["volume.block.filesystem"] != "" {
return s.pool.Config["volume.block.filesystem"]
}
return "ext4"
} | go | {
"resource": ""
} |
q177307 | copyWithoutSnapshotsFull | test | func (s *storageCeph) copyWithoutSnapshotsFull(target container,
source container) error {
logger.Debugf(`Creating non-sparse copy of RBD storage volume for container "%s" to "%s" without snapshots`, source.Name(), target.Name())
sourceIsSnapshot := source.IsSnapshot()
sourceContainerName := projectPrefix(source.P... | go | {
"resource": ""
} |
q177308 | copyWithoutSnapshotsSparse | test | func (s *storageCeph) copyWithoutSnapshotsSparse(target container,
source container) error {
logger.Debugf(`Creating sparse copy of RBD storage volume for container "%s" to "%s" without snapshots`, source.Name(),
target.Name())
sourceIsSnapshot := source.IsSnapshot()
sourceContainerName := projectPrefix(source.P... | go | {
"resource": ""
} |
q177309 | GetConfigCmd | test | func GetConfigCmd(noPortForwarding *bool) *cobra.Command {
var format string
getConfig := &cobra.Command{
Short: "Retrieve Pachyderm's current auth configuration",
Long: "Retrieve Pachyderm's current auth configuration",
Run: cmdutil.RunFixedArgs(0, func(args []string) error {
c, err := client.NewOnUserMach... | go | {
"resource": ""
} |
q177310 | SetConfigCmd | test | func SetConfigCmd(noPortForwarding *bool) *cobra.Command {
var file string
setConfig := &cobra.Command{
Short: "Set Pachyderm's current auth configuration",
Long: "Set Pachyderm's current auth configuration",
Run: cmdutil.RunFixedArgs(0, func(args []string) error {
c, err := client.NewOnUserMachine(true, !*... | go | {
"resource": ""
} |
q177311 | NewSharder | test | func NewSharder(discoveryClient discovery.Client, numShards uint64, namespace string) Sharder {
return newSharder(discoveryClient, numShards, namespace)
} | go | {
"resource": ""
} |
q177312 | NewRouter | test | func NewRouter(
sharder Sharder,
dialer grpcutil.Dialer,
localAddress string,
) Router {
return newRouter(
sharder,
dialer,
localAddress,
)
} | go | {
"resource": ""
} |
q177313 | renewUserCredentials | test | func renewUserCredentials(ctx context.Context, pachdAddress string, adminToken string, userToken string, ttl time.Duration) error {
// Setup a single use client w the given admin token / address
client, err := pclient.NewFromAddress(pachdAddress)
if err != nil {
return err
}
defer client.Close() // avoid leaking... | go | {
"resource": ""
} |
q177314 | NewLocalClient | test | func NewLocalClient(root string) (Client, error) {
if err := os.MkdirAll(root, 0755); err != nil {
return nil, err
}
return &localClient{root}, nil
} | go | {
"resource": ""
} |
q177315 | AddSpanToAnyExisting | test | func AddSpanToAnyExisting(ctx context.Context, operation string, kvs ...interface{}) (opentracing.Span, context.Context) {
if parentSpan := opentracing.SpanFromContext(ctx); parentSpan != nil {
span := opentracing.StartSpan(operation, opentracing.ChildOf(parentSpan.Context()))
tagSpan(span, kvs)
return span, ope... | go | {
"resource": ""
} |
q177316 | InstallJaegerTracerFromEnv | test | func InstallJaegerTracerFromEnv() {
jaegerOnce.Do(func() {
jaegerEndpoint, onUserMachine := os.LookupEnv(jaegerEndpointEnvVar)
if !onUserMachine {
if host, ok := os.LookupEnv("JAEGER_COLLECTOR_SERVICE_HOST"); ok {
port := os.Getenv("JAEGER_COLLECTOR_SERVICE_PORT_JAEGER_COLLECTOR_HTTP")
jaegerEndpoint = ... | go | {
"resource": ""
} |
q177317 | UnaryClientInterceptor | test | func UnaryClientInterceptor() grpc.UnaryClientInterceptor {
return otgrpc.OpenTracingClientInterceptor(opentracing.GlobalTracer(),
otgrpc.IncludingSpans(addTraceIfTracingEnabled))
} | go | {
"resource": ""
} |
q177318 | StreamClientInterceptor | test | func StreamClientInterceptor() grpc.StreamClientInterceptor {
return otgrpc.OpenTracingStreamClientInterceptor(opentracing.GlobalTracer(),
otgrpc.IncludingSpans(addTraceIfTracingEnabled))
} | go | {
"resource": ""
} |
q177319 | UnaryServerInterceptor | test | func UnaryServerInterceptor() grpc.UnaryServerInterceptor {
return otgrpc.OpenTracingServerInterceptor(opentracing.GlobalTracer(),
otgrpc.IncludingSpans(addTraceIfTracingEnabled))
} | go | {
"resource": ""
} |
q177320 | StreamServerInterceptor | test | func StreamServerInterceptor() grpc.StreamServerInterceptor {
return otgrpc.OpenTracingStreamServerInterceptor(opentracing.GlobalTracer(),
otgrpc.IncludingSpans(addTraceIfTracingEnabled))
} | go | {
"resource": ""
} |
q177321 | CloseAndReportTraces | test | func CloseAndReportTraces() {
if c, ok := opentracing.GlobalTracer().(io.Closer); ok {
c.Close()
}
} | go | {
"resource": ""
} |
q177322 | newWriter | test | func newWriter(ctx context.Context, objC obj.Client, prefix string) *Writer {
// Initialize buzhash64 with WindowSize window.
hash := buzhash64.New()
hash.Write(make([]byte, WindowSize))
return &Writer{
ctx: ctx,
objC: objC,
prefix: prefix,
cbs: []func([]*DataRef) error{},
buf: &... | go | {
"resource": ""
} |
q177323 | For | test | func (b *ConstantBackOff) For(maxElapsed time.Duration) *ConstantBackOff {
b.MaxElapsedTime = maxElapsed
return b
} | go | {
"resource": ""
} |
q177324 | Log | test | func (l *logger) Log(request interface{}, response interface{}, err error, duration time.Duration) {
if err != nil {
l.LogAtLevelFromDepth(request, response, err, duration, logrus.ErrorLevel, 4)
} else {
l.LogAtLevelFromDepth(request, response, err, duration, logrus.InfoLevel, 4)
}
// We have to grab the method... | go | {
"resource": ""
} |
q177325 | Format | test | func (f FormatterFunc) Format(entry *logrus.Entry) ([]byte, error) {
return f(entry)
} | go | {
"resource": ""
} |
q177326 | NewGRPCLogWriter | test | func NewGRPCLogWriter(logger *logrus.Logger, source string) *GRPCLogWriter {
return &GRPCLogWriter{
logger: logger,
source: source,
}
} | go | {
"resource": ""
} |
q177327 | Read | test | func Read() (*Config, error) {
var c *Config
// Read json file
p := configPath()
if raw, err := ioutil.ReadFile(p); err == nil {
err = json.Unmarshal(raw, &c)
if err != nil {
return nil, err
}
} else if os.IsNotExist(err) {
// File doesn't exist, so create a new config
fmt.Println("no config detected... | go | {
"resource": ""
} |
q177328 | Write | test | func (c *Config) Write() error {
rawConfig, err := json.MarshalIndent(c, "", " ")
if err != nil {
return err
}
// If we're not using a custom config path, create the default config path
p := configPath()
if _, ok := os.LookupEnv(configEnvVar); ok {
// using overridden config path -- just make sure the paren... | go | {
"resource": ""
} |
q177329 | Read | test | func (r *readWriter) Read(val proto.Message) error {
buf, err := r.ReadBytes()
if err != nil {
return err
}
return proto.Unmarshal(buf, val)
} | go | {
"resource": ""
} |
q177330 | Write | test | func (r *readWriter) Write(val proto.Message) (int64, error) {
bytes, err := proto.Marshal(val)
if err != nil {
return 0, err
}
return r.WriteBytes(bytes)
} | go | {
"resource": ""
} |
q177331 | NewReadWriter | test | func NewReadWriter(rw io.ReadWriter) ReadWriter {
return &readWriter{r: rw, w: rw}
} | go | {
"resource": ""
} |
q177332 | RunGitHookServer | test | func RunGitHookServer(address string, etcdAddress string, etcdPrefix string) error {
c, err := client.NewFromAddress(address)
if err != nil {
return err
}
etcdClient, err := etcd.New(etcd.Config{
Endpoints: []string{etcdAddress},
DialOptions: client.DefaultDialOptions(),
})
if err != nil {
return err
}... | go | {
"resource": ""
} |
q177333 | newLoggingPipe | test | func newLoggingPipe() *loggingPipe {
p := &loggingPipe{}
p.clientReader, p.clientWriter = io.Pipe()
p.clientReader = io.TeeReader(p.clientReader, &p.ServerToClientBuf)
p.serverReader, p.serverWriter = io.Pipe()
p.serverReader = io.TeeReader(p.serverReader, &p.ClientToServerBuf)
return p
} | go | {
"resource": ""
} |
q177334 | Read | test | func (l *loggingConn) Read(b []byte) (n int, err error) {
return l.r.Read(b)
} | go | {
"resource": ""
} |
q177335 | Write | test | func (l *loggingConn) Write(b []byte) (n int, err error) {
return l.w.Write(b)
} | go | {
"resource": ""
} |
q177336 | Accept | test | func (l *TestListener) Accept() (net.Conn, error) {
conn := <-l.connCh
if conn == nil {
return nil, errors.New("Accept() has already been called on this TestListener")
}
return conn, nil
} | go | {
"resource": ""
} |
q177337 | Close | test | func (l *TestListener) Close() error {
l.connMu.Lock()
defer l.connMu.Unlock()
c := <-l.connCh
if c != nil {
close(l.connCh)
}
return nil
} | go | {
"resource": ""
} |
q177338 | errorf | test | func errorf(c ErrCode, fmtStr string, args ...interface{}) error {
return &hashTreeError{
code: c,
s: fmt.Sprintf(fmtStr, args...),
}
} | go | {
"resource": ""
} |
q177339 | InitWithKube | test | func InitWithKube(config *Configuration) *ServiceEnv {
env := InitServiceEnv(config)
env.kubeEg.Go(env.initKubeClient)
return env // env is not ready yet
} | go | {
"resource": ""
} |
q177340 | GetEtcdClient | test | func (env *ServiceEnv) GetEtcdClient() *etcd.Client {
if err := env.etcdEg.Wait(); err != nil {
panic(err) // If env can't connect, there's no sensible way to recover
}
if env.etcdClient == nil {
panic("service env never connected to etcd")
}
return env.etcdClient
} | go | {
"resource": ""
} |
q177341 | GetKubeClient | test | func (env *ServiceEnv) GetKubeClient() *kube.Clientset {
if err := env.kubeEg.Wait(); err != nil {
panic(err) // If env can't connect, there's no sensible way to recover
}
if env.kubeClient == nil {
panic("service env never connected to kubernetes")
}
return env.kubeClient
} | go | {
"resource": ""
} |
q177342 | NewHasher | test | func NewHasher(jobModulus uint64, pipelineModulus uint64) *Hasher {
return &Hasher{
JobModulus: jobModulus,
PipelineModulus: pipelineModulus,
}
} | go | {
"resource": ""
} |
q177343 | HashJob | test | func (s *Hasher) HashJob(jobID string) uint64 {
return uint64(adler32.Checksum([]byte(jobID))) % s.JobModulus
} | go | {
"resource": ""
} |
q177344 | HashPipeline | test | func (s *Hasher) HashPipeline(pipelineName string) uint64 {
return uint64(adler32.Checksum([]byte(pipelineName))) % s.PipelineModulus
} | go | {
"resource": ""
} |
q177345 | Status | test | func Status(ctx context.Context, pipelineRcName string, etcdClient *etcd.Client, etcdPrefix string, workerGrpcPort uint16) ([]*pps.WorkerStatus, error) {
workerClients, err := Clients(ctx, pipelineRcName, etcdClient, etcdPrefix, workerGrpcPort)
if err != nil {
return nil, err
}
var result []*pps.WorkerStatus
for... | go | {
"resource": ""
} |
q177346 | Cancel | test | func Cancel(ctx context.Context, pipelineRcName string, etcdClient *etcd.Client,
etcdPrefix string, workerGrpcPort uint16, jobID string, dataFilter []string) error {
workerClients, err := Clients(ctx, pipelineRcName, etcdClient, etcdPrefix, workerGrpcPort)
if err != nil {
return err
}
success := false
for _, wo... | go | {
"resource": ""
} |
q177347 | Conns | test | func Conns(ctx context.Context, pipelineRcName string, etcdClient *etcd.Client, etcdPrefix string, workerGrpcPort uint16) ([]*grpc.ClientConn, error) {
resp, err := etcdClient.Get(ctx, path.Join(etcdPrefix, WorkerEtcdPrefix, pipelineRcName), etcd.WithPrefix())
if err != nil {
return nil, err
}
var result []*grpc.... | go | {
"resource": ""
} |
q177348 | Clients | test | func Clients(ctx context.Context, pipelineRcName string, etcdClient *etcd.Client, etcdPrefix string, workerGrpcPort uint16) ([]Client, error) {
conns, err := Conns(ctx, pipelineRcName, etcdClient, etcdPrefix, workerGrpcPort)
if err != nil {
return nil, err
}
var result []Client
for _, conn := range conns {
res... | go | {
"resource": ""
} |
q177349 | NewClient | test | func NewClient(address string) (Client, error) {
port, err := strconv.Atoi(os.Getenv(client.PPSWorkerPortEnv))
if err != nil {
return Client{}, err
}
conn, err := grpc.Dial(fmt.Sprintf("%s:%d", address, port),
append(client.DefaultDialOptions(), grpc.WithInsecure())...)
if err != nil {
return Client{}, err
... | go | {
"resource": ""
} |
q177350 | RunFixedArgs | test | func RunFixedArgs(numArgs int, run func([]string) error) func(*cobra.Command, []string) {
return func(cmd *cobra.Command, args []string) {
if len(args) != numArgs {
fmt.Printf("expected %d arguments, got %d\n\n", numArgs, len(args))
cmd.Usage()
} else {
if err := run(args); err != nil {
ErrorAndExit("... | go | {
"resource": ""
} |
q177351 | RunBoundedArgs | test | func RunBoundedArgs(min int, max int, run func([]string) error) func(*cobra.Command, []string) {
return func(cmd *cobra.Command, args []string) {
if len(args) < min || len(args) > max {
fmt.Printf("expected %d to %d arguments, got %d\n\n", min, max, len(args))
cmd.Usage()
} else {
if err := run(args); err... | go | {
"resource": ""
} |
q177352 | Run | test | func Run(run func(args []string) error) func(*cobra.Command, []string) {
return func(_ *cobra.Command, args []string) {
if err := run(args); err != nil {
ErrorAndExit(err.Error())
}
}
} | go | {
"resource": ""
} |
q177353 | ErrorAndExit | test | func ErrorAndExit(format string, args ...interface{}) {
if errString := strings.TrimSpace(fmt.Sprintf(format, args...)); errString != "" {
fmt.Fprintf(os.Stderr, "%s\n", errString)
}
os.Exit(1)
} | go | {
"resource": ""
} |
q177354 | ParseCommit | test | func ParseCommit(arg string) (*pfs.Commit, error) {
parts := strings.SplitN(arg, "@", 2)
if parts[0] == "" {
return nil, fmt.Errorf("invalid format \"%s\": repo cannot be empty", arg)
}
commit := &pfs.Commit{
Repo: &pfs.Repo{
Name: parts[0],
},
ID: "",
}
if len(parts) == 2 {
commit.ID = parts[1]
}
... | go | {
"resource": ""
} |
q177355 | ParseBranch | test | func ParseBranch(arg string) (*pfs.Branch, error) {
commit, err := ParseCommit(arg)
if err != nil {
return nil, err
}
return &pfs.Branch{Repo: commit.Repo, Name: commit.ID}, nil
} | go | {
"resource": ""
} |
q177356 | ParseFile | test | func ParseFile(arg string) (*pfs.File, error) {
repoAndRest := strings.SplitN(arg, "@", 2)
if repoAndRest[0] == "" {
return nil, fmt.Errorf("invalid format \"%s\": repo cannot be empty", arg)
}
file := &pfs.File{
Commit: &pfs.Commit{
Repo: &pfs.Repo{
Name: repoAndRest[0],
},
ID: "",
},
Path: ""... | go | {
"resource": ""
} |
q177357 | Set | test | func (r *RepeatedStringArg) Set(s string) error {
*r = append(*r, s)
return nil
} | go | {
"resource": ""
} |
q177358 | SetDocsUsage | test | func SetDocsUsage(command *cobra.Command) {
command.SetHelpTemplate(`{{or .Long .Short}}
{{.UsageString}}
`)
command.SetUsageFunc(func(cmd *cobra.Command) error {
rootCmd := cmd.Root()
// Walk the command tree, finding commands with the documented word
var associated []*cobra.Command
var walk func(*cobra.C... | go | {
"resource": ""
} |
q177359 | makeCronCommits | test | func (a *apiServer) makeCronCommits(pachClient *client.APIClient, in *pps.Input) error {
schedule, err := cron.ParseStandard(in.Cron.Spec)
if err != nil {
return err // Shouldn't happen, as the input is validated in CreatePipeline
}
// make sure there isn't an unfinished commit on the branch
commitInfo, err := p... | go | {
"resource": ""
} |
q177360 | Writer | test | func (o *tracingObjClient) Writer(ctx context.Context, name string) (io.WriteCloser, error) {
span, ctx := tracing.AddSpanToAnyExisting(ctx, o.provider+".Writer", "name", name)
if span != nil {
defer span.Finish()
}
return o.Client.Writer(ctx, name)
} | go | {
"resource": ""
} |
q177361 | Reader | test | func (o *tracingObjClient) Reader(ctx context.Context, name string, offset uint64, size uint64) (io.ReadCloser, error) {
span, ctx := tracing.AddSpanToAnyExisting(ctx, o.provider+".Reader",
"name", name,
"offset", fmt.Sprintf("%d", offset),
"size", fmt.Sprintf("%d", size))
defer tracing.FinishAnySpan(span)
ret... | go | {
"resource": ""
} |
q177362 | Delete | test | func (o *tracingObjClient) Delete(ctx context.Context, name string) error {
span, ctx := tracing.AddSpanToAnyExisting(ctx, o.provider+".Delete",
"name", name)
defer tracing.FinishAnySpan(span)
return o.Client.Delete(ctx, name)
} | go | {
"resource": ""
} |
q177363 | Walk | test | func (o *tracingObjClient) Walk(ctx context.Context, prefix string, fn func(name string) error) error {
span, ctx := tracing.AddSpanToAnyExisting(ctx, o.provider+".Walk",
"prefix", prefix)
defer tracing.FinishAnySpan(span)
return o.Client.Walk(ctx, prefix, fn)
} | go | {
"resource": ""
} |
q177364 | Exists | test | func (o *tracingObjClient) Exists(ctx context.Context, name string) bool {
span, ctx := tracing.AddSpanToAnyExisting(ctx, o.provider+".Exists",
"name", name)
defer tracing.FinishAnySpan(span)
return o.Client.Exists(ctx, name)
} | go | {
"resource": ""
} |
q177365 | GetBlock | test | func GetBlock(hash hash.Hash) *Block {
return &Block{
Hash: base64.URLEncoding.EncodeToString(hash.Sum(nil)),
}
} | go | {
"resource": ""
} |
q177366 | Health | test | func (h *healthServer) Health(context.Context, *types.Empty) (*types.Empty, error) {
if !h.ready {
return nil, fmt.Errorf("server not ready")
}
return &types.Empty{}, nil
} | go | {
"resource": ""
} |
q177367 | split | test | func split(p string) (string, string) {
return clean(path.Dir(p)), base(p)
} | go | {
"resource": ""
} |
q177368 | ValidatePath | test | func ValidatePath(path string) error {
path = clean(path)
match, _ := regexp.MatchString("^[ -~]+$", path)
if !match {
return fmt.Errorf("path (%v) invalid: only printable ASCII characters allowed", path)
}
if IsGlob(path) {
return fmt.Errorf("path (%v) invalid: globbing character (%v) not allowed in path", ... | go | {
"resource": ""
} |
q177369 | MatchDatum | test | func MatchDatum(filter []string, data []*pps.InputFile) bool {
// All paths in request.DataFilters must appear somewhere in the log
// line's inputs, or it's filtered
matchesData := true
dataFilters:
for _, dataFilter := range filter {
for _, datum := range data {
if dataFilter == datum.Path ||
dataFilter ... | go | {
"resource": ""
} |
q177370 | NewCacheServer | test | func NewCacheServer(router shard.Router, shards uint64) CacheServer {
server := &groupCacheServer{
Logger: log.NewLogger("CacheServer"),
router: router,
localShards: make(map[uint64]bool),
shards: shards,
}
groupcache.RegisterPeerPicker(func() groupcache.PeerPicker { return server })
return s... | go | {
"resource": ""
} |
q177371 | authorizePipelineOp | test | func (a *apiServer) authorizePipelineOp(pachClient *client.APIClient, operation pipelineOperation, input *pps.Input, output string) error {
ctx := pachClient.Ctx()
me, err := pachClient.WhoAmI(ctx, &auth.WhoAmIRequest{})
if auth.IsErrNotActivated(err) {
return nil // Auth isn't activated, skip authorization comple... | go | {
"resource": ""
} |
q177372 | sudo | test | func (a *apiServer) sudo(pachClient *client.APIClient, f func(*client.APIClient) error) error {
// Get PPS auth token
superUserTokenOnce.Do(func() {
b := backoff.NewExponentialBackOff()
b.MaxElapsedTime = 60 * time.Second
b.MaxInterval = 5 * time.Second
if err := backoff.Retry(func() error {
superUserToken... | go | {
"resource": ""
} |
q177373 | setPipelineDefaults | test | func setPipelineDefaults(pipelineInfo *pps.PipelineInfo) {
now := time.Now()
if pipelineInfo.Transform.Image == "" {
pipelineInfo.Transform.Image = DefaultUserImage
}
pps.VisitInput(pipelineInfo.Input, func(input *pps.Input) {
if input.Pfs != nil {
if input.Pfs.Branch == "" {
input.Pfs.Branch = "master"
... | go | {
"resource": ""
} |
q177374 | incrementGCGeneration | test | func (a *apiServer) incrementGCGeneration(ctx context.Context) error {
resp, err := a.env.GetEtcdClient().Get(ctx, client.GCGenerationKey)
if err != nil {
return err
}
if resp.Count == 0 {
// If the generation number does not exist, create it.
// It's important that the new generation is 1, as the first
//... | go | {
"resource": ""
} |
q177375 | NewDebugServer | test | func NewDebugServer(name string, etcdClient *etcd.Client, etcdPrefix string, workerGrpcPort uint16) debug.DebugServer {
return &debugServer{
name: name,
etcdClient: etcdClient,
etcdPrefix: etcdPrefix,
workerGrpcPort: workerGrpcPort,
}
} | go | {
"resource": ""
} |
q177376 | Health | test | func (c APIClient) Health() error {
_, err := c.healthClient.Health(c.Ctx(), &types.Empty{})
return grpcutil.ScrubGRPC(err)
} | go | {
"resource": ""
} |
q177377 | newObjBlockAPIServer | test | func newObjBlockAPIServer(dir string, cacheBytes int64, etcdAddress string, objClient obj.Client, test bool) (*objBlockAPIServer, error) {
// defensive measure to make sure storage is working and error early if it's not
// this is where we'll find out if the credentials have been misconfigured
if err := obj.TestStor... | go | {
"resource": ""
} |
q177378 | watchGC | test | func (s *objBlockAPIServer) watchGC(etcdAddress string) {
b := backoff.NewInfiniteBackOff()
backoff.RetryNotify(func() error {
etcdClient, err := etcd.New(etcd.Config{
Endpoints: []string{etcdAddress},
DialOptions: client.DefaultDialOptions(),
})
if err != nil {
return fmt.Errorf("error instantiating... | go | {
"resource": ""
} |
q177379 | splitKey | test | func (s *objBlockAPIServer) splitKey(key string) string {
gen := s.getGeneration()
if len(key) < prefixLength {
return fmt.Sprintf("%s.%d", key, gen)
}
return fmt.Sprintf("%s.%s.%d", key[:prefixLength], key[prefixLength:], gen)
} | go | {
"resource": ""
} |
q177380 | NewWriter | test | func NewWriter(w io.Writer, header string) *Writer {
if header[len(header)-1] != '\n' {
panic("header must end in a new line")
}
tabwriter := ansiterm.NewTabWriter(w, 0, 1, 1, ' ', 0)
tabwriter.Write([]byte(header))
return &Writer{
w: tabwriter,
lines: 1, // 1 because we just printed the header
heade... | go | {
"resource": ""
} |
q177381 | Write | test | func (w *Writer) Write(buf []byte) (int, error) {
if w.lines >= termHeight {
if err := w.Flush(); err != nil {
return 0, err
}
if _, err := w.w.Write(w.header); err != nil {
return 0, err
}
w.lines++
}
w.lines += bytes.Count(buf, []byte{'\n'})
return w.w.Write(buf)
} | go | {
"resource": ""
} |
q177382 | PrintRepoHeader | test | func PrintRepoHeader(w io.Writer, printAuth bool) {
if printAuth {
fmt.Fprint(w, RepoAuthHeader)
return
}
fmt.Fprint(w, RepoHeader)
} | go | {
"resource": ""
} |
q177383 | PrintRepoInfo | test | func PrintRepoInfo(w io.Writer, repoInfo *pfs.RepoInfo, fullTimestamps bool) {
fmt.Fprintf(w, "%s\t", repoInfo.Repo.Name)
if fullTimestamps {
fmt.Fprintf(w, "%s\t", repoInfo.Created.String())
} else {
fmt.Fprintf(w, "%s\t", pretty.Ago(repoInfo.Created))
}
fmt.Fprintf(w, "%s\t", units.BytesSize(float64(repoInfo... | go | {
"resource": ""
} |
q177384 | PrintDetailedRepoInfo | test | func PrintDetailedRepoInfo(repoInfo *PrintableRepoInfo) error {
template, err := template.New("RepoInfo").Funcs(funcMap).Parse(
`Name: {{.Repo.Name}}{{if .Description}}
Description: {{.Description}}{{end}}{{if .FullTimestamps}}
Created: {{.Created}}{{else}}
Created: {{prettyAgo .Created}}{{end}}
Size of HEAD on mast... | go | {
"resource": ""
} |
q177385 | PrintBranch | test | func PrintBranch(w io.Writer, branchInfo *pfs.BranchInfo) {
fmt.Fprintf(w, "%s\t", branchInfo.Branch.Name)
if branchInfo.Head != nil {
fmt.Fprintf(w, "%s\t\n", branchInfo.Head.ID)
} else {
fmt.Fprintf(w, "-\t\n")
}
} | go | {
"resource": ""
} |
q177386 | PrintCommitInfo | test | func PrintCommitInfo(w io.Writer, commitInfo *pfs.CommitInfo, fullTimestamps bool) {
fmt.Fprintf(w, "%s\t", commitInfo.Commit.Repo.Name)
fmt.Fprintf(w, "%s\t", commitInfo.Branch.Name)
fmt.Fprintf(w, "%s\t", commitInfo.Commit.ID)
if commitInfo.ParentCommit != nil {
fmt.Fprintf(w, "%s\t", commitInfo.ParentCommit.ID... | go | {
"resource": ""
} |
q177387 | PrintDetailedCommitInfo | test | func PrintDetailedCommitInfo(commitInfo *PrintableCommitInfo) error {
template, err := template.New("CommitInfo").Funcs(funcMap).Parse(
`Commit: {{.Commit.Repo.Name}}@{{.Commit.ID}}{{if .Branch}}
Original Branch: {{.Branch.Name}}{{end}}{{if .Description}}
Description: {{.Description}}{{end}}{{if .ParentCommit}}
Pare... | go | {
"resource": ""
} |
q177388 | PrintFileInfo | test | func PrintFileInfo(w io.Writer, fileInfo *pfs.FileInfo, fullTimestamps bool) {
fmt.Fprintf(w, "%s\t", fileInfo.File.Commit.ID)
fmt.Fprintf(w, "%s\t", fileInfo.File.Path)
if fileInfo.FileType == pfs.FileType_FILE {
fmt.Fprint(w, "file\t")
} else {
fmt.Fprint(w, "dir\t")
}
if fileInfo.Committed == nil {
fmt.F... | go | {
"resource": ""
} |
q177389 | PrintDetailedFileInfo | test | func PrintDetailedFileInfo(fileInfo *pfs.FileInfo) error {
template, err := template.New("FileInfo").Funcs(funcMap).Parse(
`Path: {{.File.Path}}
Type: {{fileType .FileType}}
Size: {{prettySize .SizeBytes}}
Children: {{range .Children}} {{.}} {{end}}
`)
if err != nil {
return err
}
return template.Execute(os.Std... | go | {
"resource": ""
} |
q177390 | Add | test | func Add(s string, ancestors int) string {
return fmt.Sprintf("%s~%d", s, ancestors)
} | go | {
"resource": ""
} |
q177391 | RetryNotify | test | func RetryNotify(operation Operation, b BackOff, notify Notify) error {
var err error
var next time.Duration
b.Reset()
for {
if err = operation(); err == nil {
return nil
}
if next = b.NextBackOff(); next == Stop {
return err
}
if notify != nil {
if err := notify(err, next); err != nil {
r... | go | {
"resource": ""
} |
q177392 | Get | test | func (c *MergeCache) Get(id int64, w io.Writer, filter Filter) (retErr error) {
r, err := c.Cache.Get(fmt.Sprint(id))
if err != nil {
return err
}
defer func() {
if err := r.Close(); err != nil && retErr == nil {
retErr = err
}
}()
return NewWriter(w).Copy(NewReader(r, filter))
} | go | {
"resource": ""
} |
q177393 | Delete | test | func (c *MergeCache) Delete(id int64) error {
return c.Cache.Delete(fmt.Sprint(id))
} | go | {
"resource": ""
} |
q177394 | PrintJobInfo | test | func PrintJobInfo(w io.Writer, jobInfo *ppsclient.JobInfo, fullTimestamps bool) {
fmt.Fprintf(w, "%s\t", jobInfo.Job.ID)
fmt.Fprintf(w, "%s\t", jobInfo.Pipeline.Name)
if fullTimestamps {
fmt.Fprintf(w, "%s\t", jobInfo.Started.String())
} else {
fmt.Fprintf(w, "%s\t", pretty.Ago(jobInfo.Started))
}
if jobInfo.... | go | {
"resource": ""
} |
q177395 | PrintPipelineInfo | test | func PrintPipelineInfo(w io.Writer, pipelineInfo *ppsclient.PipelineInfo, fullTimestamps bool) {
fmt.Fprintf(w, "%s\t", pipelineInfo.Pipeline.Name)
fmt.Fprintf(w, "%s\t", ShorthandInput(pipelineInfo.Input))
if fullTimestamps {
fmt.Fprintf(w, "%s\t", pipelineInfo.CreatedAt.String())
} else {
fmt.Fprintf(w, "%s\t... | go | {
"resource": ""
} |
q177396 | PrintWorkerStatus | test | func PrintWorkerStatus(w io.Writer, workerStatus *ppsclient.WorkerStatus, fullTimestamps bool) {
fmt.Fprintf(w, "%s\t", workerStatus.WorkerID)
fmt.Fprintf(w, "%s\t", workerStatus.JobID)
for _, datum := range workerStatus.Data {
fmt.Fprintf(w, datum.Path)
}
fmt.Fprintf(w, "\t")
if fullTimestamps {
fmt.Fprintf(... | go | {
"resource": ""
} |
q177397 | PrintDetailedJobInfo | test | func PrintDetailedJobInfo(jobInfo *PrintableJobInfo) error {
template, err := template.New("JobInfo").Funcs(funcMap).Parse(
`ID: {{.Job.ID}} {{if .Pipeline}}
Pipeline: {{.Pipeline.Name}} {{end}} {{if .ParentJob}}
Parent: {{.ParentJob.ID}} {{end}}{{if .FullTimestamps}}
Started: {{.Started}}{{else}}
Started: {{prettyA... | go | {
"resource": ""
} |
q177398 | PrintDetailedPipelineInfo | test | func PrintDetailedPipelineInfo(pipelineInfo *PrintablePipelineInfo) error {
template, err := template.New("PipelineInfo").Funcs(funcMap).Parse(
`Name: {{.Pipeline.Name}}{{if .Description}}
Description: {{.Description}}{{end}}{{if .FullTimestamps }}
Created: {{.CreatedAt}}{{ else }}
Created: {{prettyAgo .CreatedAt}} ... | go | {
"resource": ""
} |
q177399 | PrintDatumInfo | test | func PrintDatumInfo(w io.Writer, datumInfo *ppsclient.DatumInfo) {
totalTime := "-"
if datumInfo.Stats != nil {
totalTime = units.HumanDuration(client.GetDatumTotalTime(datumInfo.Stats))
}
fmt.Fprintf(w, "%s\t%s\t%s\n", datumInfo.Datum.ID, datumState(datumInfo.State), totalTime)
} | go | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.