dumper

package
v0.0.0-...-e560ebb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 56 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Jobs = []*cron.CronTab{
	{

		Name:     "ufs.dumper",
		Time:     20 * time.Minute,
		TrigType: cron.DAILY,
		Job:      dump,
	},
	{

		Name:     "ufs.cros_inventory.dump",
		Time:     60 * time.Minute,
		TrigType: cron.EVERY,
		Job:      dumpCrosInventory,
	},
	{

		Name:     "ufs.change_event.BqDump",
		Time:     10 * time.Minute,
		TrigType: cron.EVERY,
		Job:      dumpChangeEvent,
	},
	{

		Name:     "ufs.snapshot_msg.BqDump",
		Time:     10 * time.Minute,
		TrigType: cron.EVERY,
		Job:      dumpChangeSnapshots,
	},
	{

		Name:     "ufs.cros_network.dump",
		Time:     60 * time.Minute,
		TrigType: cron.EVERY,
		Job:      dumpCrosNetwork,
	},
	{

		Name:     "ufs.sync_devices.sync",
		TrigType: cron.HOURLY,
		Job:      SyncAssetInfoFromHaRT,
	},
	{

		Name:     "ufs.sync_assets.sync",
		Time:     5 * time.Minute,
		TrigType: cron.HOURLY,
		Job:      SyncAssetsFromIV2,
	},
	{

		Name:     "ufs.push_to_drone_queen",
		Time:     10 * time.Minute,
		TrigType: cron.EVERY,
		Job:      pushToDroneQueen,
	},
	{

		Name:     "ufs.dump_to_invv2_devices",
		Time:     10 * time.Minute,
		TrigType: cron.DAILY,
		Job:      DumpToInventoryDeviceSnapshot,
	},
	{

		Name:     "ufs.dump_to_invv2_dutstates",
		Time:     15 * time.Minute,
		TrigType: cron.DAILY,
		Job:      DumpToInventoryDutStateSnapshot,
	},
	{

		Name:     "ufs.report_inventory",
		Time:     5 * time.Minute,
		TrigType: cron.EVERY,
		Job:      reportUFSInventoryCronHandler,
	},
}

Jobs is a list of all the cron jobs that are currently available for running

Functions

func Cmp

func Cmp(iv2Asset, ufsAsset *ufspb.Asset) bool

Cmp does protobuf comparison between both inputs

func Compare

func Compare(iv2Machine, ufsMachine *ufspb.Machine) bool

Compare does protobuf comparison between both inputs

func DeviceDataToBQDeviceMsgs

func DeviceDataToBQDeviceMsgs(ctx context.Context, devicesData []*DeviceData) []proto.Message

DeviceDataToBQDeviceMsgs converts a sequence of devices data into messages that can be committed to bigquery.

func DumpToInventoryDeviceSnapshot

func DumpToInventoryDeviceSnapshot(ctx context.Context) error

DumpToInventoryDeviceSnapshot dump UFS MachineLSE to InvV2 labconfig BQ

func DumpToInventoryDutStateSnapshot

func DumpToInventoryDutStateSnapshot(ctx context.Context) error

DumpToInventoryDutStateSnapshot dumpe UFS DutState to InvV2 stateconfig BQ

func DutStateDataToBQDutStateMsgs

func DutStateDataToBQDutStateMsgs(ctx context.Context, dutStatesData []*DutStateData) []proto.Message

DutStateDataToBQDutStateMsgs converts a sequence of dutStates data into messages that can be committed to bigquery.

func GetAllAssetInfo

func GetAllAssetInfo(ctx context.Context, client *datastore.Client) (map[string]*iv2pr2.AssetInfo, error)

GetAllAssetInfo retrieves all the asset info data from inventory-V2

func GetAllAssets

func GetAllAssets(ctx context.Context, client *datastore.Client) ([]*iv2pr.ChopsAsset, error)

GetAllAssets retrieves all the asset data from inventory-V2

func GetAssetToHostnameMap

func GetAssetToHostnameMap(ctx context.Context, client *bigquery.Client) (map[string]string, error)

GetAssetToHostnameMap gets the asset tag to hostname mapping from assets_in_swarming BQ table

func InitServer

func InitServer(srv *server.Server)

InitServer initializes a cron server.

func InstallCronServices

func InstallCronServices(apiServer *prpc.Server)

InstallCronServices installs ...

func SyncAssetInfoFromHaRT

func SyncAssetInfoFromHaRT(ctx context.Context) error

SyncAssetInfoFromHaRT publishes the request for asset info to HaRT.

The response for this request will be made to an endpoint on an RPC call. This function only checks for the assets that have Device info missing or the last update on the device was 48 hours ago.

func SyncAssetsFromIV2

func SyncAssetsFromIV2(ctx context.Context) error

SyncAssetsFromIV2 updates assets table in UFS using data from IV2

func SyncMachinesFromAssets

func SyncMachinesFromAssets(ctx context.Context) error

SyncMachinesFromAssets updates machines table from assets table

Checks all the DUT and Labstation assets and creates/updates machines if required.

func TriggerJob

func TriggerJob(name string) error

Triggers a job by name. Returns error if the job is not found.

func Use

func Use(ctx context.Context, bqClient *bigquery.Client) context.Context

Use installs bigquery client to context.

func UseProject

func UseProject(ctx context.Context, project string) context.Context

UseProject installs project name to context.

Types

type CronServerImpl

type CronServerImpl struct {
}

func (*CronServerImpl) TriggerCronJob

func (c *CronServerImpl) TriggerCronJob(ctx context.Context, job *api.TriggerCronJobReq) (*empty.Empty, error)

TriggerCronJob triggers the given cron job to run. Fails if the Job is already running.

type DeviceData

type DeviceData struct {
	Device     *invlab.ChromeOSDevice
	UpdateTime *timestamppb.Timestamp
}

DeviceData holds the invV2 Device and updatetime(of MachineLSE)

type DutStateData

type DutStateData struct {
	DutState   *invlab.DutState
	UpdateTime *timestamppb.Timestamp
}

DutStateData holds the invV2 DutState and updatetime

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL