Skip to content

Commit c915a75

Browse files
committed
refactor: move pypi downloads out of deps-dev
Signed-off-by: anilb <epipav@gmail.com>
1 parent a0c9edf commit c915a75

11 files changed

Lines changed: 14 additions & 10 deletions

File tree

services/apps/packages_worker/src/activities.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ export {
3030
ingestPypiPackageBatch,
3131
pypiStopAfterFirstPage,
3232
} from './pypi/activities'
33+
export { getCriticalPypiCount } from './pypi/downloads/getCriticalPypiCount'
3334
export { processNuGetBatch } from './nuget/activities'

services/apps/packages_worker/src/bin/bq-dataset-ingest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { scheduleOsspckgsBootstrap } from '../deps-dev/schedules/bootstrap'
22
import {
33
schedulePypiDownloads30d,
44
schedulePypiDownloadsDaily,
5-
} from '../deps-dev/schedules/pypiDownloads'
5+
} from '../pypi/downloads/pypiDownloads'
66
import { svc } from '../service'
77

88
setImmediate(async () => {

services/apps/packages_worker/src/deps-dev/activities/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export * from './bqExportToGcs'
2-
export * from './getCriticalPypiCount'
32
export * from './setJobStep'
43
export * from './createVersionsLookup'
54
export * from './managePackageDepsConstraints'

services/apps/packages_worker/src/deps-dev/workflows/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ export * from './ingestAdvisories'
33
export * from './ingestDependentCounts'
44
export * from './ingestDependencies'
55
export * from './ingestPackages'
6-
export * from './ingestPypiDownloads'
76
export * from './ingestRepos'
87
export * from './ingestVersions'

services/apps/packages_worker/src/deps-dev/queries/__tests__/pypiDownloads.test.ts renamed to services/apps/packages_worker/src/pypi/downloads/__tests__/pypiDownloads.test.ts

File renamed without changes.

services/apps/packages_worker/src/deps-dev/activities/getCriticalPypiCount.ts renamed to services/apps/packages_worker/src/pypi/downloads/getCriticalPypiCount.ts

File renamed without changes.

services/apps/packages_worker/src/deps-dev/workflows/ingestPypiDownloads.ts renamed to services/apps/packages_worker/src/pypi/downloads/ingestPypiDownloads.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { proxyActivities, workflowInfo } from '@temporalio/workflow'
22

3-
import type * as depsDevActivities from '../activities'
3+
import type * as depsDevActivities from '../../deps-dev/activities'
4+
5+
import type * as pypiDownloadsActivities from './getCriticalPypiCount'
46
import {
57
computeLast30dWindows,
68
defaultDailyRange,
79
utcFirstOfCurrentMonth,
8-
} from '../queries/pypiDownloadsDates'
10+
} from './pypiDownloadsDates'
911
import {
1012
PYPI_DOWNLOADS_30D_KIND,
1113
PYPI_DOWNLOADS_30D_STAGING,
@@ -15,7 +17,7 @@ import {
1517
buildPypiDownloads30dSql,
1618
buildPypiDownloadsDailyMergeSql,
1719
buildPypiDownloadsDailySql,
18-
} from '../queries/pypiDownloadsSql'
20+
} from './pypiDownloadsSql'
1921

2022
const { bqExportToGcs } = proxyActivities<typeof depsDevActivities>({
2123
startToCloseTimeout: '1 hour',
@@ -38,7 +40,7 @@ const { mergeStagingToTable } = proxyActivities<typeof depsDevActivities>({
3840
retry: { maximumAttempts: 1 },
3941
})
4042

41-
const { getCriticalPypiCount } = proxyActivities<typeof depsDevActivities>({
43+
const { getCriticalPypiCount } = proxyActivities<typeof pypiDownloadsActivities>({
4244
startToCloseTimeout: '1 minute',
4345
retry: { maximumAttempts: 3 },
4446
})

services/apps/packages_worker/src/deps-dev/schedules/pypiDownloads.ts renamed to services/apps/packages_worker/src/pypi/downloads/pypiDownloads.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { ScheduleAlreadyRunning, ScheduleOverlapPolicy } from '@temporalio/client'
22

33
import { svc } from '../../service'
4-
import { ingestPypiDownloadsDaily, ingestPypiDownloadsLast30d } from '../workflows'
4+
5+
import { ingestPypiDownloadsDaily, ingestPypiDownloadsLast30d } from './ingestPypiDownloads'
56

67
// Last-30d downloads for all pypi packages. Runs on the 4th of the month (06:00 UTC) — a few
78
// days after the window's end (1st of the month) so the BigQuery partitions have settled. No

services/apps/packages_worker/src/deps-dev/queries/pypiDownloadsDates.ts renamed to services/apps/packages_worker/src/pypi/downloads/pypiDownloadsDates.ts

File renamed without changes.

services/apps/packages_worker/src/deps-dev/queries/pypiDownloadsSql.ts renamed to services/apps/packages_worker/src/pypi/downloads/pypiDownloadsSql.ts

File renamed without changes.

0 commit comments

Comments
 (0)