Documentation ¶
Index ¶
- Variables
- func Cmp(iv2Asset, ufsAsset *ufspb.Asset) bool
- func Compare(iv2Machine, ufsMachine *ufspb.Machine) bool
- func DeviceDataToBQDeviceMsgs(ctx context.Context, devicesData []*DeviceData) []proto.Message
- func DumpToInventoryDeviceSnapshot(ctx context.Context) error
- func DumpToInventoryDutStateSnapshot(ctx context.Context) error
- func DutStateDataToBQDutStateMsgs(ctx context.Context, dutStatesData []*DutStateData) []proto.Message
- func GetAllAssetInfo(ctx context.Context, client *datastore.Client) (map[string]*iv2pr2.AssetInfo, error)
- func GetAllAssets(ctx context.Context, client *datastore.Client) ([]*iv2pr.ChopsAsset, error)
- func GetAssetToHostnameMap(ctx context.Context, client *bigquery.Client) (map[string]string, error)
- func InitServer(srv *server.Server)
- func InstallCronServices(apiServer *prpc.Server)
- func SyncAssetInfoFromHaRT(ctx context.Context) error
- func SyncAssetsFromIV2(ctx context.Context) error
- func SyncMachinesFromAssets(ctx context.Context) error
- func TriggerJob(name string) error
- func Use(ctx context.Context, bqClient *bigquery.Client) context.Context
- func UseProject(ctx context.Context, project string) context.Context
- type CronServerImpl
- type DeviceData
- type DutStateData
Constants ¶
This section is empty.
Variables ¶
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 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 ¶
DumpToInventoryDeviceSnapshot dump UFS MachineLSE to InvV2 labconfig BQ
func DumpToInventoryDutStateSnapshot ¶
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 ¶
GetAllAssets retrieves all the asset data from inventory-V2
func GetAssetToHostnameMap ¶
GetAssetToHostnameMap gets the asset tag to hostname mapping from assets_in_swarming BQ table
func InstallCronServices ¶
InstallCronServices installs ...
func SyncAssetInfoFromHaRT ¶
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 ¶
SyncAssetsFromIV2 updates assets table in UFS using data from IV2
func SyncMachinesFromAssets ¶
SyncMachinesFromAssets updates machines table from assets table
Checks all the DUT and Labstation assets and creates/updates machines if required.
func TriggerJob ¶
Triggers a job by name. Returns error if the job is not found.
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