Revert "Feat: Build output size"
This commit is contained in:
parent
708994d4a6
commit
ff9bccf1ff
10 changed files with 36 additions and 77 deletions
|
@ -4,7 +4,6 @@
|
||||||
- Increase Traefik TCP + file limits [#4673](https://github.com/appwrite/appwrite/pull/4673)
|
- Increase Traefik TCP + file limits [#4673](https://github.com/appwrite/appwrite/pull/4673)
|
||||||
- Fix invited account verified status [#4776](https://github.com/appwrite/appwrite/pull/4776)
|
- Fix invited account verified status [#4776](https://github.com/appwrite/appwrite/pull/4776)
|
||||||
- Get default region from environment on project create [#4780](https://github.com/appwrite/appwrite/pull/4780)
|
- Get default region from environment on project create [#4780](https://github.com/appwrite/appwrite/pull/4780)
|
||||||
- Store build output file size [#4844](https://github.com/appwrite/appwrite/pull/4844)
|
|
||||||
- Fix max mimetype size [#4814](https://github.com/appwrite/appwrite/pull/4814)
|
- Fix max mimetype size [#4814](https://github.com/appwrite/appwrite/pull/4814)
|
||||||
|
|
||||||
# Version 1.1.2
|
# Version 1.1.2
|
||||||
|
|
|
@ -2561,6 +2561,17 @@ $collections = [
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'filters' => ['datetime'],
|
'filters' => ['datetime'],
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'$id' => ID::custom('endTime'),
|
||||||
|
'type' => Database::VAR_DATETIME,
|
||||||
|
'format' => '',
|
||||||
|
'size' => 0,
|
||||||
|
'signed' => false,
|
||||||
|
'required' => false,
|
||||||
|
'default' => null,
|
||||||
|
'array' => false,
|
||||||
|
'filters' => ['datetime'],
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'$id' => ID::custom('duration'),
|
'$id' => ID::custom('duration'),
|
||||||
'type' => Database::VAR_INTEGER,
|
'type' => Database::VAR_INTEGER,
|
||||||
|
@ -2606,7 +2617,7 @@ $collections = [
|
||||||
'filters' => [],
|
'filters' => [],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'$id' => ID::custom('path'),
|
'$id' => ID::custom('outputPath'),
|
||||||
'type' => Database::VAR_STRING,
|
'type' => Database::VAR_STRING,
|
||||||
'format' => '',
|
'format' => '',
|
||||||
'size' => 2048,
|
'size' => 2048,
|
||||||
|
@ -2616,17 +2627,6 @@ $collections = [
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'filters' => [],
|
'filters' => [],
|
||||||
],
|
],
|
||||||
[
|
|
||||||
'$id' => ID::custom('size'),
|
|
||||||
'type' => Database::VAR_INTEGER,
|
|
||||||
'format' => '',
|
|
||||||
'size' => 0,
|
|
||||||
'signed' => true,
|
|
||||||
'required' => false,
|
|
||||||
'default' => null,
|
|
||||||
'array' => false,
|
|
||||||
'filters' => [],
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
'$id' => ID::custom('stderr'),
|
'$id' => ID::custom('stderr'),
|
||||||
'type' => Database::VAR_STRING,
|
'type' => Database::VAR_STRING,
|
||||||
|
|
|
@ -1197,7 +1197,7 @@ App::post('/v1/functions/:functionId/executions')
|
||||||
variables: $vars,
|
variables: $vars,
|
||||||
timeout: $function->getAttribute('timeout', 0),
|
timeout: $function->getAttribute('timeout', 0),
|
||||||
image: $runtime['image'],
|
image: $runtime['image'],
|
||||||
source: $build->getAttribute('path', ''),
|
source: $build->getAttribute('outputPath', ''),
|
||||||
entrypoint: $deployment->getAttribute('entrypoint', ''),
|
entrypoint: $deployment->getAttribute('entrypoint', ''),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -99,13 +99,13 @@ class BuildsV1 extends Worker
|
||||||
'startTime' => $startTime,
|
'startTime' => $startTime,
|
||||||
'deploymentId' => $deployment->getId(),
|
'deploymentId' => $deployment->getId(),
|
||||||
'status' => 'processing',
|
'status' => 'processing',
|
||||||
'path' => '',
|
'outputPath' => '',
|
||||||
'size' => 0,
|
|
||||||
'runtime' => $function->getAttribute('runtime'),
|
'runtime' => $function->getAttribute('runtime'),
|
||||||
'source' => $deployment->getAttribute('path'),
|
'source' => $deployment->getAttribute('path'),
|
||||||
'sourceType' => $device,
|
'sourceType' => $device,
|
||||||
'stdout' => '',
|
'stdout' => '',
|
||||||
'stderr' => '',
|
'stderr' => '',
|
||||||
|
'endTime' => null,
|
||||||
'duration' => 0
|
'duration' => 0
|
||||||
]));
|
]));
|
||||||
$deployment->setAttribute('buildId', $buildId);
|
$deployment->setAttribute('buildId', $buildId);
|
||||||
|
@ -186,12 +186,14 @@ class BuildsV1 extends Worker
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$endTime = new \DateTime();
|
||||||
|
$endTime->setTimestamp($response['endTimeUnix']);
|
||||||
|
|
||||||
/** Update the build document */
|
/** Update the build document */
|
||||||
$build->setAttribute('startTime', DateTime::format((new \DateTime())->setTimestamp($response['startTime'])));
|
$build->setAttribute('endTime', DateTime::format($endTime));
|
||||||
$build->setAttribute('duration', \intval($response['duration']));
|
$build->setAttribute('duration', \intval($response['duration']));
|
||||||
$build->setAttribute('status', $response['status']);
|
$build->setAttribute('status', $response['status']);
|
||||||
$build->setAttribute('path', $response['path']);
|
$build->setAttribute('outputPath', $response['outputPath']);
|
||||||
$build->setAttribute('size', $response['size']);
|
|
||||||
$build->setAttribute('stderr', $response['stderr']);
|
$build->setAttribute('stderr', $response['stderr']);
|
||||||
$build->setAttribute('stdout', $response['stdout']);
|
$build->setAttribute('stdout', $response['stdout']);
|
||||||
|
|
||||||
|
@ -222,7 +224,7 @@ class BuildsV1 extends Worker
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
$endTime = DateTime::now();
|
$endTime = DateTime::now();
|
||||||
$interval = (new \DateTime($endTime))->diff(new \DateTime($startTime));
|
$interval = (new \DateTime($endTime))->diff(new \DateTime($startTime));
|
||||||
|
$build->setAttribute('endTime', $endTime);
|
||||||
$build->setAttribute('duration', $interval->format('%s') + 0);
|
$build->setAttribute('duration', $interval->format('%s') + 0);
|
||||||
$build->setAttribute('status', 'failed');
|
$build->setAttribute('status', 'failed');
|
||||||
$build->setAttribute('stderr', $th->getMessage());
|
$build->setAttribute('stderr', $th->getMessage());
|
||||||
|
@ -258,7 +260,6 @@ class BuildsV1 extends Worker
|
||||||
->setParam('builds.{scope}.compute', 1)
|
->setParam('builds.{scope}.compute', 1)
|
||||||
->setParam('buildStatus', $build->getAttribute('status', ''))
|
->setParam('buildStatus', $build->getAttribute('status', ''))
|
||||||
->setParam('buildTime', $build->getAttribute('duration'))
|
->setParam('buildTime', $build->getAttribute('duration'))
|
||||||
->setParam('buildSize', $build->getAttribute('size'))
|
|
||||||
->setParam('networkRequestSize', 0)
|
->setParam('networkRequestSize', 0)
|
||||||
->setParam('networkResponseSize', 0)
|
->setParam('networkResponseSize', 0)
|
||||||
->submit();
|
->submit();
|
||||||
|
|
|
@ -486,10 +486,10 @@ class DeletesV1 extends Worker
|
||||||
$this->deleteByGroup('builds', [
|
$this->deleteByGroup('builds', [
|
||||||
Query::equal('deploymentId', [$deploymentId])
|
Query::equal('deploymentId', [$deploymentId])
|
||||||
], $dbForProject, function (Document $document) use ($storageBuilds, $deploymentId) {
|
], $dbForProject, function (Document $document) use ($storageBuilds, $deploymentId) {
|
||||||
if ($storageBuilds->delete($document->getAttribute('path', ''), true)) {
|
if ($storageBuilds->delete($document->getAttribute('outputPath', ''), true)) {
|
||||||
Console::success('Deleted build files: ' . $document->getAttribute('path', ''));
|
Console::success('Deleted build files: ' . $document->getAttribute('outputPath', ''));
|
||||||
} else {
|
} else {
|
||||||
Console::error('Failed to delete build files: ' . $document->getAttribute('path', ''));
|
Console::error('Failed to delete build files: ' . $document->getAttribute('outputPath', ''));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -535,10 +535,10 @@ class DeletesV1 extends Worker
|
||||||
$this->deleteByGroup('builds', [
|
$this->deleteByGroup('builds', [
|
||||||
Query::equal('deploymentId', [$deploymentId])
|
Query::equal('deploymentId', [$deploymentId])
|
||||||
], $dbForProject, function (Document $document) use ($storageBuilds) {
|
], $dbForProject, function (Document $document) use ($storageBuilds) {
|
||||||
if ($storageBuilds->delete($document->getAttribute('path', ''), true)) {
|
if ($storageBuilds->delete($document->getAttribute('outputPath', ''), true)) {
|
||||||
Console::success('Deleted build files: ' . $document->getAttribute('path', ''));
|
Console::success('Deleted build files: ' . $document->getAttribute('outputPath', ''));
|
||||||
} else {
|
} else {
|
||||||
Console::error('Failed to delete build files: ' . $document->getAttribute('path', ''));
|
Console::error('Failed to delete build files: ' . $document->getAttribute('outputPath', ''));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ Server::setResource('execute', function () {
|
||||||
variables: $vars,
|
variables: $vars,
|
||||||
timeout: $function->getAttribute('timeout', 0),
|
timeout: $function->getAttribute('timeout', 0),
|
||||||
image: $runtime['image'],
|
image: $runtime['image'],
|
||||||
source: $build->getAttribute('path', ''),
|
source: $build->getAttribute('outputPath', ''),
|
||||||
entrypoint: $deployment->getAttribute('entrypoint', ''),
|
entrypoint: $deployment->getAttribute('entrypoint', ''),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -658,7 +658,7 @@ services:
|
||||||
hostname: exc1
|
hostname: exc1
|
||||||
<<: *x-logging
|
<<: *x-logging
|
||||||
stop_signal: SIGINT
|
stop_signal: SIGINT
|
||||||
image: openruntimes/executor:0.2.0
|
image: openruntimes/executor:0.1.6
|
||||||
networks:
|
networks:
|
||||||
- appwrite
|
- appwrite
|
||||||
- runtimes
|
- runtimes
|
||||||
|
|
|
@ -56,48 +56,9 @@ class V17 extends Migration
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
Console::warning("'mimeType' from {$id}: {$th->getMessage()}");
|
Console::warning("'mimeType' from {$id}: {$th->getMessage()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'builds':
|
|
||||||
try {
|
|
||||||
/**
|
|
||||||
* Create 'size' attribute
|
|
||||||
*/
|
|
||||||
$this->createAttributeFromCollection($this->projectDB, $id, 'size');
|
|
||||||
$this->projectDB->deleteCachedCollection($id);
|
|
||||||
} catch (\Throwable $th) {
|
|
||||||
Console::warning("'size' from {$id}: {$th->getMessage()}");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
/**
|
|
||||||
* Delete 'endTime' attribute (use startTime+duration if needed)
|
|
||||||
*/
|
|
||||||
$this->projectDB->deleteAttribute($id, 'endTime');
|
|
||||||
$this->projectDB->deleteCachedCollection($id);
|
|
||||||
} catch (\Throwable $th) {
|
|
||||||
Console::warning("'endTime' from {$id}: {$th->getMessage()}");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
/**
|
|
||||||
* Rename 'outputPath' to 'path'
|
|
||||||
*/
|
|
||||||
$this->projectDB->renameAttribute($id, 'outputPath', 'path');
|
|
||||||
$this->projectDB->deleteCachedCollection($id);
|
|
||||||
} catch (\Throwable $th) {
|
|
||||||
Console::warning("'path' from {$id}: {$th->getMessage()}");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
/**
|
|
||||||
* Create 'size'
|
|
||||||
*/
|
|
||||||
$this->createAttributeFromCollection($this->projectDB, $id, 'size');
|
|
||||||
$this->projectDB->deleteCachedCollection($id);
|
|
||||||
} catch (\Throwable $th) {
|
|
||||||
Console::warning("'size' from {$id}: {$th->getMessage()}");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,7 +184,6 @@ class Stats
|
||||||
|
|
||||||
$functionBuild = $this->params['builds.{scope}.compute'] ?? 0;
|
$functionBuild = $this->params['builds.{scope}.compute'] ?? 0;
|
||||||
$functionBuildTime = ($this->params['buildTime'] ?? 0) * 1000; // ms
|
$functionBuildTime = ($this->params['buildTime'] ?? 0) * 1000; // ms
|
||||||
$functionBuildSize = ($this->params['buildSize'] ?? 0); // bytes
|
|
||||||
$functionBuildStatus = $this->params['buildStatus'] ?? '';
|
$functionBuildStatus = $this->params['buildStatus'] ?? '';
|
||||||
$functionCompute = $functionExecutionTime + $functionBuildTime;
|
$functionCompute = $functionExecutionTime + $functionBuildTime;
|
||||||
$functionTags = $tags . ',functionId=' . $functionId;
|
$functionTags = $tags . ',functionId=' . $functionId;
|
||||||
|
@ -208,7 +207,6 @@ class Stats
|
||||||
if ($functionBuild >= 1) {
|
if ($functionBuild >= 1) {
|
||||||
$this->statsd->increment('builds.{scope}.compute' . $functionTags . ',functionBuildStatus=' . $functionBuildStatus);
|
$this->statsd->increment('builds.{scope}.compute' . $functionTags . ',functionBuildStatus=' . $functionBuildStatus);
|
||||||
$this->statsd->count('builds.{scope}.compute.time' . $functionTags, $functionBuildTime);
|
$this->statsd->count('builds.{scope}.compute.time' . $functionTags, $functionBuildTime);
|
||||||
$this->statsd->count('builds.{scope}.storage.size' . $functionTags, $functionBuildSize);
|
|
||||||
}
|
}
|
||||||
if ($functionBuild + $functionExecution >= 1) {
|
if ($functionBuild + $functionExecution >= 1) {
|
||||||
$this->statsd->count('project.{scope}.compute.time' . $functionTags, $functionCompute);
|
$this->statsd->count('project.{scope}.compute.time' . $functionTags, $functionCompute);
|
||||||
|
|
|
@ -51,18 +51,18 @@ class Build extends Model
|
||||||
'default' => '',
|
'default' => '',
|
||||||
'example' => self::TYPE_DATETIME_EXAMPLE,
|
'example' => self::TYPE_DATETIME_EXAMPLE,
|
||||||
])
|
])
|
||||||
|
->addRule('endTime', [
|
||||||
|
'type' => self::TYPE_DATETIME,
|
||||||
|
'description' => 'The time the build was finished in ISO 8601 format.',
|
||||||
|
'default' => '',
|
||||||
|
'example' => self::TYPE_DATETIME_EXAMPLE,
|
||||||
|
])
|
||||||
->addRule('duration', [
|
->addRule('duration', [
|
||||||
'type' => self::TYPE_INTEGER,
|
'type' => self::TYPE_INTEGER,
|
||||||
'description' => 'The build duration in seconds.',
|
'description' => 'The build duration in seconds.',
|
||||||
'default' => 0,
|
'default' => 0,
|
||||||
'example' => 0,
|
'example' => 0,
|
||||||
])
|
])
|
||||||
->addRule('size', [
|
|
||||||
'type' => self::TYPE_INTEGER,
|
|
||||||
'description' => 'The code size in bytes.',
|
|
||||||
'default' => 0,
|
|
||||||
'example' => 128,
|
|
||||||
])
|
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue