@hestia-earth/pipeline-utils 0.10.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.10.1](https://gitlab.com/hestia-earth/hestia-pipeline-utils/compare/v0.10.0...v0.10.1) (2023-06-08)
6
+
7
+
8
+ ### Features
9
+
10
+ * **ec2:** add `startInstances` function ([0ee1283](https://gitlab.com/hestia-earth/hestia-pipeline-utils/commit/0ee128334b9fe2a174aafd96e40e61fc83bcda26))
11
+
5
12
  ## [0.10.0](https://gitlab.com/hestia-earth/hestia-pipeline-utils/compare/v0.9.6...v0.10.0) (2023-06-08)
6
13
 
7
14
 
package/dist/ec2.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const startInstances: (functionName: string, instanceIds?: string[]) => import("rxjs").Observable<any>;
package/dist/ec2.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.startInstances = void 0;
4
+ const AWS = require("aws-sdk");
5
+ const rxjs_1 = require("rxjs");
6
+ const operators_1 = require("rxjs/operators");
7
+ const log_1 = require("./log");
8
+ const s3_1 = require("./s3");
9
+ const defaultInstanceIds = (process.env.START_INSTANCE_ID || '').split(',');
10
+ const startInstances = (functionName, instanceIds = defaultInstanceIds) => s3_1.isS3Mode
11
+ ? (0, rxjs_1.from)(new AWS.EC2().startInstances({
12
+ InstanceIds: instanceIds
13
+ }).promise()).pipe((0, operators_1.take)(1), (0, operators_1.map)(res => {
14
+ (0, log_1.debug)(`EC2 start instances ${functionName}`, res);
15
+ return res;
16
+ }))
17
+ : (0, rxjs_1.of)(null);
18
+ exports.startInstances = startInstances;
19
+ //# sourceMappingURL=ec2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ec2.js","sourceRoot":"","sources":["../src/ec2.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,+BAAgC;AAChC,8CAA2C;AAE3C,+BAA8B;AAC9B,6BAAgC;AAEhC,MAAM,kBAAkB,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAErE,MAAM,cAAc,GAAG,CAAC,YAAoB,EAAE,WAAW,GAAG,kBAAkB,EAAE,EAAE,CAAC,aAAQ;IAChG,CAAC,CAAC,IAAA,WAAI,EACJ,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC;QAC3B,WAAW,EAAE,WAAW;KACzB,CAAC,CAAC,OAAO,EAAE,CACb,CAAC,IAAI,CACJ,IAAA,gBAAI,EAAC,CAAC,CAAC,EACP,IAAA,eAAG,EAAC,GAAG,CAAC,EAAE;QACR,IAAA,WAAK,EAAC,uBAAuB,YAAY,EAAE,EAAE,GAAG,CAAC,CAAC;QAClD,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CACH;IACD,CAAC,CAAC,IAAA,SAAE,EAAC,IAAI,CAAC,CAAC;AAZA,QAAA,cAAc,kBAYd"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './ec2';
1
2
  export * from './lambda';
2
3
  export * from './log';
3
4
  export * from './progress';
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ec2"), exports);
17
18
  __exportStar(require("./lambda"), exports);
18
19
  __exportStar(require("./log"), exports);
19
20
  __exportStar(require("./progress"), exports);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,wCAAsB;AACtB,6CAA2B;AAC3B,6CAA2B;AAC3B,uCAAqB;AACrB,wCAAsB;AACtB,wCAAsB;AACtB,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,2CAAyB;AACzB,wCAAsB;AACtB,6CAA2B;AAC3B,6CAA2B;AAC3B,uCAAqB;AACrB,wCAAsB;AACtB,wCAAsB;AACtB,0CAAwB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hestia-earth/pipeline-utils",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Utilities for running pipelines",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
package/src/ec2.ts ADDED
@@ -0,0 +1,22 @@
1
+ import * as AWS from 'aws-sdk';
2
+ import { from, of } from 'rxjs';
3
+ import { take, map } from 'rxjs/operators';
4
+
5
+ import { debug } from './log';
6
+ import { isS3Mode } from './s3';
7
+
8
+ const defaultInstanceIds = (process.env.START_INSTANCE_ID || '').split(',');
9
+
10
+ export const startInstances = (functionName: string, instanceIds = defaultInstanceIds) => isS3Mode
11
+ ? from(
12
+ new AWS.EC2().startInstances({
13
+ InstanceIds: instanceIds
14
+ }).promise()
15
+ ).pipe(
16
+ take(1),
17
+ map(res => {
18
+ debug(`EC2 start instances ${functionName}`, res);
19
+ return res;
20
+ })
21
+ )
22
+ : of(null);
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './ec2';
1
2
  export * from './lambda';
2
3
  export * from './log';
3
4
  export * from './progress';