@@ -39,6 +39,21 @@ commands:
39
39
if [[ "${PYTHON_VERSION}" = *3.9* ]]; then
40
40
echo "export CONDA_CHANNEL_FLAGS=-c=conda-forge" >> ${BASH_ENV}
41
41
fi
42
+ generate_cachekey :
43
+ description : " Generate .cachekey file that changes on daily basis"
44
+ steps :
45
+ - run :
46
+ name : Generate CCI cache key
47
+ command : echo "$(date "+%D")" > .cachekey
48
+ - persist_to_workspace :
49
+ root : .
50
+ paths :
51
+ - .cachekey
52
+ fetch_cachekey :
53
+ description : " Fetch the .cachekey file that is generated by generate_cachekey job"
54
+ steps :
55
+ - attach_workspace :
56
+ at : .
42
57
43
58
binary_common : &binary_common
44
59
parameters :
@@ -356,64 +371,34 @@ jobs:
356
371
- checkout
357
372
- designate_upload_channel
358
373
- load_conda_channel_flags
359
- - run :
360
- name : Generate cache key
361
- # This will refresh cache on Sundays, nightly build should generate new cache.
362
- command : |
363
- echo "$(date +"Year-Week %Y-%U")" > .circleci-weekly
364
- echo "$(date +"Year-Date %Y-%d")" > .circleci-daily-linux
365
- - persist_to_workspace :
366
- root : .
367
- paths :
368
- - .circleci-daily-linux
374
+ - generate_cachekey
369
375
- restore_cache :
370
376
keys :
371
377
372
- - data -linux-v1- {{ checksum ".circleci-daily-linux " }}
378
+ - v1 -linux-cache-index- {{ checksum ".cachekey " }}
373
379
374
380
- run :
375
- name : Exit if cache exists
381
+ name : Generate cache
382
+ no_output_timeout : 30m
376
383
command : |
377
- FILE=.data/cache_status_file.json
378
- if test -f "$FILE"; then
379
- cat $FILE
380
- circleci step halt
381
- else
382
- echo "$FILE does not exists"
384
+ if [ ! -f .data/cache_status_file.json ] ; then
385
+ .circleci/unittest/linux/scripts/setup_env.sh
386
+ .circleci/unittest/linux/scripts/install.sh
387
+ .circleci/unittest/linux/scripts/generate_cache.sh
383
388
fi
384
- - restore_cache :
385
-
386
- keys :
387
- - env-v1-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".circleci-weekly" }}
388
-
389
- - run :
390
- name : Setup
391
- command : .circleci/unittest/linux/scripts/setup_env.sh
389
+ cat .data/cache_status_file.json
392
390
- save_cache :
393
391
394
- key : env- v1-linux-{{ arch }}-py<< parameters.python_version >>- {{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".circleci-weekly " }}
392
+ key : v1-linux-dataset- {{ checksum ".cachekey " }}
395
393
396
394
paths :
397
- - conda
398
- - env
399
- - run :
400
- name : Install torchtext
401
- command : .circleci/unittest/linux/scripts/install.sh
402
- - run :
403
- name : Generate daily data Cache
404
- no_output_timeout : 30m
405
- command : |
406
- .circleci/unittest/linux/scripts/generate_cache.sh
407
- cat .data/cache_status_file.json
395
+ - .data
408
396
- save_cache :
409
397
410
- key : data -linux-v1- {{ checksum ".circleci-daily-linux " }}
398
+ key : v1 -linux-cache-index- {{ checksum ".cachekey " }}
411
399
412
400
paths :
413
- - .data
414
- - run :
415
- name : Post process
416
- command : .circleci/unittest/linux/scripts/post_process.sh
401
+ - .data/cache_status_file.json
417
402
418
403
unittest_linux :
419
404
<< : *binary_common
@@ -424,40 +409,18 @@ jobs:
424
409
- checkout
425
410
- designate_upload_channel
426
411
- load_conda_channel_flags
427
- - attach_workspace :
428
- at : .
429
- - run :
430
- name : Generate cache key
431
- # This will refresh cache on Sundays, nightly build should generate new cache.
432
- command : |
433
- echo "$(date +"Year-Week %Y-%U")" > .circleci-weekly
434
- - restore_cache :
435
-
436
- keys :
437
- - env-v1-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".circleci-weekly" }}
438
-
412
+ - fetch_cachekey
439
413
- run :
440
414
name : Setup
441
415
command : .circleci/unittest/linux/scripts/setup_env.sh
442
- - save_cache :
443
-
444
- key : env-v1-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".circleci-weekly" }}
445
-
446
- paths :
447
- - conda
448
- - env
449
416
- run :
450
417
name : Install torchtext
451
418
command : .circleci/unittest/linux/scripts/install.sh
452
419
- restore_cache :
453
420
keys :
454
421
455
- - data-linux-v1-{{ checksum ".circleci-daily-linux" }}
456
-
457
- - restore_cache :
458
- keys :
459
-
460
- - data-vector-linux-v1-{{ checksum ".circleci-daily-linux" }}
422
+ - v1-linux-dataset-vector-{{ checksum ".cachekey" }}
423
+ - v1-linux-dataset-{{ checksum ".cachekey" }}
461
424
462
425
- run :
463
426
name : Run tests
@@ -466,7 +429,7 @@ jobs:
466
429
command : .circleci/unittest/linux/scripts/run_test.sh
467
430
- save_cache :
468
431
469
- key : data-vector- linux-v1- {{ checksum ".circleci-daily-linux " }}
432
+ key : v1- linux-dataset-vector- {{ checksum ".cachekey " }}
470
433
471
434
paths :
472
435
- .vector_cache
@@ -485,67 +448,34 @@ jobs:
485
448
- checkout
486
449
- designate_upload_channel
487
450
- load_conda_channel_flags
488
- - run :
489
- name : Generate cache key
490
- # This will refresh cache on Sundays, nightly build should generate new cache.
491
- command : |
492
- echo "$(date +"Year-Week %Y-%U")" > .circleci-weekly
493
- echo "$(date +"Year-Date %Y-%d")" > .circleci-daily-win
494
- - persist_to_workspace :
495
- root : .
496
- paths :
497
- - .circleci-daily-win
451
+ - generate_cachekey
498
452
- restore_cache :
499
453
keys :
500
454
501
- - data-windows-v1-{{ checksum ".circleci-daily-win" }}
502
-
503
- - run :
504
- name : Exit if cache exists
505
- command : |
506
- FILE=.data/cache_status_file.json
507
- if test -f "$FILE"; then
508
- cat $FILE
509
- circleci step halt
510
- else
511
- echo "$FILE does not exists"
512
- fi
513
- - restore_cache :
514
-
515
- keys :
516
- - env-v1-windows-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/windows/scripts/environment.yml" }}-{{ checksum ".circleci-weekly" }}
517
-
518
- - run :
519
- name : Setup
520
- command : .circleci/unittest/windows/scripts/setup_env.sh
521
- - save_cache :
522
-
523
- key : env-v1-windows-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/windows/scripts/environment.yml" }}-{{ checksum ".circleci-weekly" }}
455
+ - v1-windows-cache-index-{{ checksum ".cachekey" }}
524
456
525
- paths :
526
- - conda
527
- - env
528
- - run :
529
- name : Install torchtext
530
- command : .circleci/unittest/windows/scripts/install.sh
531
457
- run :
532
458
name : Generate daily data Cache
533
459
no_output_timeout : 30m
534
460
command : |
535
- .circleci/unittest/windows/scripts/generate_cache.sh
461
+ if [ ! -f .data/cache_status_file.json ] ; then
462
+ .circleci/unittest/windows/scripts/setup_env.sh
463
+ .circleci/unittest/windows/scripts/install.sh
464
+ .circleci/unittest/windows/scripts/generate_cache.sh
465
+ fi
536
466
cat .data/cache_status_file.json
537
467
- save_cache :
538
468
539
- key : data -windows-v1 -{{ checksum ".circleci-daily-win " }}
469
+ key : v1 -windows-dataset -{{ checksum ".cachekey " }}
540
470
541
471
paths :
542
472
- .data
543
- - run :
544
- name : Post process
545
- command : .circleci/unittest/windows/scripts/post_process.sh
546
-
473
+ - save_cache :
547
474
475
+ key : v1-windows-cache-index-{{ checksum ".cachekey" }}
548
476
477
+ paths :
478
+ - .data/cache_status_file.json
549
479
550
480
unittest_windows :
551
481
<< : *binary_common
@@ -555,40 +485,18 @@ jobs:
555
485
- checkout
556
486
- designate_upload_channel
557
487
- load_conda_channel_flags
558
- - attach_workspace :
559
- at : .
560
- - run :
561
- name : Generate cache key
562
- # This will refresh cache on Sundays, nightly build should generate new cache.
563
- command : |
564
- echo "$(date +"Year-Week %Y-%U")" > .circleci-weekly
565
- - restore_cache :
566
-
567
- keys :
568
- - env-v1-windows-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/windows/scripts/environment.yml" }}-{{ checksum ".circleci-weekly" }}
569
-
488
+ - fetch_cachekey
570
489
- run :
571
490
name : Setup
572
491
command : .circleci/unittest/windows/scripts/setup_env.sh
573
- - save_cache :
574
-
575
- key : env-v1-windows-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/windows/scripts/environment.yml" }}-{{ checksum ".circleci-weekly" }}
576
-
577
- paths :
578
- - conda
579
- - env
580
492
- run :
581
493
name : Install torchtext
582
494
command : .circleci/unittest/windows/scripts/install.sh
583
495
- restore_cache :
584
496
keys :
585
497
586
- - data-windows-v1-{{ checksum ".circleci-daily-win" }}
587
-
588
- - restore_cache :
589
- keys :
590
-
591
- - data-vector-windows-v1-{{ checksum ".circleci-daily-win" }}
498
+ - v1-windows-dataset-vector-{{ checksum ".cachekey" }}
499
+ - v1-windows-dataset-{{ checksum ".cachekey" }}
592
500
593
501
594
502
- run :
@@ -598,7 +506,7 @@ jobs:
598
506
command : .circleci/unittest/windows/scripts/run_test.sh
599
507
- save_cache :
600
508
601
- key : data-vector- windows-v1- {{ checksum ".circleci-daily-win " }}
509
+ key : v1- windows-dataset-vector- {{ checksum ".cachekey " }}
602
510
603
511
paths :
604
512
- .vector_cache
@@ -617,25 +525,9 @@ jobs:
617
525
steps :
618
526
- checkout
619
527
- designate_upload_channel
620
- - run :
621
- name : Generate cache key
622
- # This will refresh cache on Sundays, nightly build should generate new cache.
623
- command : echo "$(date +"Year-Week %Y-%U")" > .circleci-weekly
624
- - restore_cache :
625
-
626
- keys :
627
- - env-v1-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".circleci-weekly" }}
628
-
629
528
- run :
630
529
name : Setup
631
530
command : .circleci/unittest/linux/scripts/setup_env.sh
632
- - save_cache :
633
-
634
- key : env-v1-linux-{{ arch }}-py<< parameters.python_version >>-{{ checksum ".circleci/unittest/linux/scripts/environment.yml" }}-{{ checksum ".circleci-weekly" }}
635
-
636
- paths :
637
- - conda
638
- - env
639
531
- run :
640
532
name : Run style check
641
533
command : .circleci/unittest/linux/scripts/run_style_checks.sh
0 commit comments