Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mark-web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cylab
mark-web
Commits
e03955c8
Commit
e03955c8
authored
3 years ago
by
a.croix
Browse files
Options
Downloads
Patches
Plain Diff
Some small correction in web interface
parent
05efb997
No related branches found
No related tags found
No related merge requests found
Pipeline
#6577
passed
3 years ago
Stage: test
Stage: build
Stage: deploy
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+36
-5
36 additions, 5 deletions
.gitlab-ci.yml
.gitlab-ci.yml.bak
+5
-36
5 additions, 36 deletions
.gitlab-ci.yml.bak
app/Wowa.php
+34
-26
34 additions, 26 deletions
app/Wowa.php
resources/views/wowa/show.blade.php
+14
-2
14 additions, 2 deletions
resources/views/wowa/show.blade.php
with
89 additions
and
69 deletions
.gitlab-ci.yml
+
36
−
5
View file @
e03955c8
stages
:
-
test
-
build
-
deploy
## Cache composer packages between all jobs and all branches
## of this project...
...
...
@@ -12,24 +13,24 @@ cache:
before_script
:
-
cp env.gitlab-ci .env
-
touch storage/app/db.sqlite
-
COMPOSER_CACHE_DIR=composer-cache composer install
-
COMPOSER_CACHE_DIR=composer-cache composer install
--ignore-platform-reqs
-
php artisan key:generate
-
php artisan migrate
# Test with PHP7.4
test:php74
:
image
:
cylab/php74
image
:
${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/
cylab/php74
:latest
stage
:
test
script
:
#- vendor/bin/phpunit --coverage-text --colors=never --coverage-html build/coverage
-
vendor/bin/phpcs
artifacts
:
paths
:
-
build/
-
build/
expire_in
:
1 month
build
:
image
:
docker:19.03.1
image
:
${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/
docker:19.03.1
stage
:
build
tags
:
-
dind
...
...
@@ -42,11 +43,29 @@ build:
script
:
-
docker build -t cylab/ctf .
build:release
:
image
:
${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/docker:19.03.1
stage
:
build
tags
:
-
dind
services
:
-
docker:19.03.1-dind
variables
:
DOCKER_TLS_CERTDIR
:
"
/certs"
IMAGE_TAG
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
before_script
:
-
docker info
script
:
-
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-
docker build -t gitlab.cylab.be:8081/cylab/mark-web:$CI_COMMIT_REF_SLUG .
-
docker tag gitlab.cylab.be:8081/cylab/mark-web:$CI_COMMIT_REF_SLUG gitlab.cylab.be:8081/cylab/mark-web:latest
-
docker push gitlab.cylab.be:8081/cylab/mark-web:$CI_COMMIT_REF_SLUG
-
docker push gitlab.cylab.be:8081/cylab/mark-web:latest
build:tagged
:
only
:
-
tags
image
:
docker:19.03.1
image
:
${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/
docker:19.03.1
stage
:
build
tags
:
-
dind
...
...
@@ -62,3 +81,15 @@ build:tagged:
-
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
-
docker push cylab/mark-web:$CI_COMMIT_TAG
-
docker push cylab/mark-web:latest
deploy
:
image
:
${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/cylab/php74
stage
:
deploy
script
:
# import ssh private key
-
eval $(ssh-agent -s)
-
ssh-add <(echo "$SSH_PRIVATE_KEY")
-
mkdir -p ~/.ssh
-
echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
# in cylab/php72, envoy is already installed...
-
~/.composer/vendor/bin/envoy run deploy --commit="$CI_COMMIT_SHA"
This diff is collapsed.
Click to expand it.
.gitlab-ci.yml.bak
+
5
−
36
View file @
e03955c8
stages:
- test
- build
- deploy
## Cache composer packages between all jobs and all branches
## of this project...
...
...
@@ -13,24 +12,24 @@ cache:
before_script:
- cp env.gitlab-ci .env
- touch storage/app/db.sqlite
- COMPOSER_CACHE_DIR=composer-cache composer install
--ignore-platform-reqs
- COMPOSER_CACHE_DIR=composer-cache composer install
- php artisan key:generate
- php artisan migrate
# Test with PHP7.4
test:php74:
image:
${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/
cylab/php74
:latest
image: cylab/php74
stage: test
script:
#- vendor/bin/phpunit --coverage-text --colors=never --coverage-html build/coverage
- vendor/bin/phpcs
artifacts:
paths:
- build/
- build/
expire_in: 1 month
build:
image:
${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/
docker:19.03.1
image: docker:19.03.1
stage: build
tags:
- dind
...
...
@@ -43,29 +42,11 @@ build:
script:
- docker build -t cylab/ctf .
build:release:
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/docker:19.03.1
stage: build
tags:
- dind
services:
- docker:19.03.1-dind
variables:
DOCKER_TLS_CERTDIR: "/certs"
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
before_script:
- docker info
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t gitlab.cylab.be:8081/cylab/mark-web:$CI_COMMIT_REF_SLUG .
- docker tag gitlab.cylab.be:8081/cylab/mark-web:$CI_COMMIT_REF_SLUG gitlab.cylab.be:8081/cylab/mark-web:latest
- docker push gitlab.cylab.be:8081/cylab/mark-web:$CI_COMMIT_REF_SLUG
- docker push gitlab.cylab.be:8081/cylab/mark-web:latest
build:tagged:
only:
- tags
image:
${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/
docker:19.03.1
image: docker:19.03.1
stage: build
tags:
- dind
...
...
@@ -81,15 +62,3 @@ build:tagged:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- docker push cylab/mark-web:$CI_COMMIT_TAG
- docker push cylab/mark-web:latest
deploy:
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/cylab/php74
stage: deploy
script:
# import ssh private key
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
# in cylab/php72, envoy is already installed...
- ~/.composer/vendor/bin/envoy run deploy --commit="$CI_COMMIT_SHA"
This diff is collapsed.
Click to expand it.
app/Wowa.php
+
34
−
26
View file @
e03955c8
...
...
@@ -42,7 +42,7 @@ class Wowa extends Model
//Display text in the status badge
public
function
statusBadge
()
{
if
(
$this
->
status
==
self
::
STATE_RUNNING
||
$this
->
status
==
self
::
STATE_QUEUED
)
{
if
(
$this
->
status
==
=
self
::
STATE_RUNNING
)
{
return
"<span class='btn btn-badge btn-sm "
.
$this
->
getStatusBadgeClass
()
.
"'>"
.
$this
->
status
.
" : "
.
$this
->
getProgression
()
.
"</span>"
;
...
...
@@ -52,14 +52,14 @@ class Wowa extends Model
}
}
public
function
weightsP
()
:
array
public
function
weightsP
()
:
?
array
{
//$P = implode(',', $this->p_weights);
//return str_replace(array('[', ']'), '', $P);
return
$this
->
p_weights
;
}
public
function
weightsW
()
:
array
public
function
weightsW
()
:
?
array
{
//$W = implode(',', $this->w_weights);
//return str_replace(array('[', ']'), '', $W);
...
...
@@ -79,32 +79,40 @@ class Wowa extends Model
//Read the last line of the log file, get the progression value
public
function
getProgression
()
:
string
{
$line
=
''
;
if
(
!
file_exists
(
$this
->
getLogPathOnDisk
()))
{
return
"File not found"
;
}
$f
=
fopen
(
$this
->
getLogPathOnDisk
(),
'r'
);
$cursor
=
-
1
;
fseek
(
$f
,
$cursor
,
SEEK_END
);
$char
=
fgetc
(
$f
);
while
(
$char
===
"
\n
"
||
$char
===
"
\r
"
)
{
fseek
(
$f
,
$cursor
--
,
SEEK_END
);
$char
=
fgetc
(
$f
);
}
while
(
$char
!==
false
&&
$char
!==
"
\n
"
&&
$char
!==
"
\r
"
)
{
$line
=
$char
.
$line
;
fseek
(
$f
,
$cursor
--
,
SEEK_END
);
if
(
env
(
'LOG_CHANNEL'
)
===
'stack'
)
{
$line
=
''
;
if
(
!
file_exists
(
$this
->
getLogPathOnDisk
()))
{
return
"File not found"
;
}
$f
=
fopen
(
$this
->
getLogPathOnDisk
(),
'r'
);
$cursor
=
-
1
;
fseek
(
$f
,
$cursor
,
SEEK_END
);
$char
=
fgetc
(
$f
);
}
$generation
=
intval
(
$this
->
getStringBetween
(
$line
,
': '
,
'|'
));
if
(
$this
->
status
===
Wowa
::
STATE_COLLECTION
)
{
return
$generation
;
while
(
$char
===
"
\n
"
||
$char
===
"
\r
"
)
{
fseek
(
$f
,
$cursor
--
,
SEEK_END
);
$char
=
fgetc
(
$f
);
}
while
(
$char
!==
false
&&
$char
!==
"
\n
"
&&
$char
!==
"
\r
"
)
{
$line
=
$char
.
$line
;
fseek
(
$f
,
$cursor
--
,
SEEK_END
);
$char
=
fgetc
(
$f
);
}
$generation
=
intval
(
$this
->
getStringBetween
(
$line
,
': '
,
'|'
));
if
(
$this
->
status
===
Wowa
::
STATE_COLLECTION
)
{
return
$generation
;
}
return
((
$generation
+
1
)
/
$this
->
generation_number
)
*
100
;
}
else
{
$log
=
Log
::
where
(
'job_id'
,
$this
->
id
)
->
where
(
'training'
,
1
)
->
latest
()
->
first
();
if
(
is_null
(
$log
))
{
return
"Computation..."
;
}
}
return
((
$generation
+
1
)
/
$this
->
generation_number
)
*
100
;
return
$log
->
progression
;
}
//Method to return the value between : and | (progression)
...
...
This diff is collapsed.
Click to expand it.
resources/views/wowa/show.blade.php
+
14
−
2
View file @
e03955c8
...
...
@@ -51,7 +51,13 @@
<
div
>
<
b
>
Weights
W
Vector
:</
b
>
<
div
class
=
"input-group mb-3"
>
<
input
id
=
"w_weights"
type
=
"text"
class
=
"form-control"
readonly
value
=
"@json(
$wowa->weightsW
())"
style
=
"overflow-x: scroll"
onclick
=
"this.focus();this.select()"
>
@
if
(
$wowa
->
status
===
\App\Wowa
::
STATE_QUEUED
||
$wowa
->
status
===
\App\Wowa
::
STATE_RUNNING
||
$wowa
->
status
===
\App\Wowa
::
STATE_COLLECTION
)
<
input
id
=
"w_weights"
type
=
"text"
class
=
"form-control"
readonly
disabled
value
=
"Computation in progress..."
style
=
"overflow-x: scroll"
>
@
elseif
(
$wowa
->
status
===
\App\Wowa
::
STATE_FAILED
)
<
input
id
=
"w_weights"
type
=
"text"
class
=
"form-control"
readonly
disabled
value
=
"Failed..."
style
=
"overflow-x: scroll"
>
@
else
<
input
id
=
"w_weights"
type
=
"text"
class
=
"form-control"
readonly
value
=
"@json(
$wowa->weightsW
())"
style
=
"overflow-x: scroll"
onclick
=
"this.focus();this.select()"
>
@
endif
<
div
class
=
"input-group-append"
>
<
button
type
=
"button"
id
=
"w_weights_button"
class
=
"btn btn-info"
title
=
"Copy to clipboard"
>
Copy
</
button
>
</
div
>
...
...
@@ -60,7 +66,13 @@
<
div
>
<
b
>
Weights
W
Vector
:</
b
>
<
div
class
=
"input-group mb-3"
>
<
input
id
=
"p_weights"
type
=
"text"
class
=
"form-control"
readonly
value
=
"@json(
$wowa->weightsP
())"
style
=
"overflow: scroll"
onclick
=
"this.focus();this.select()"
>
@
if
(
$wowa
->
status
===
\App\Wowa
::
STATE_QUEUED
||
$wowa
->
status
===
\App\Wowa
::
STATE_RUNNING
||
$wowa
->
status
===
\App\Wowa
::
STATE_COLLECTION
)
<
input
id
=
"p_weights"
type
=
"text"
class
=
"form-control"
readonly
disabled
value
=
"Computation in progress..."
style
=
"overflow-x: scroll"
>
@
elseif
(
$wowa
->
status
===
\App\Wowa
::
STATE_FAILED
)
<
input
id
=
"p_weights"
type
=
"text"
class
=
"form-control"
readonly
disabled
value
=
"Computation in progress..."
style
=
"overflow-x: scroll"
>
@
else
<
input
id
=
"p_weights"
type
=
"text"
class
=
"form-control"
readonly
value
=
"@json(
$wowa->weightsP
())"
style
=
"overflow: scroll"
onclick
=
"this.focus();this.select()"
>
@
endif
<
div
class
=
"input-group-append"
>
<
button
id
=
"p_weights_button"
type
=
"button"
class
=
"btn btn-info"
title
=
"Copy to clipboard"
>
Copy
</
button
>
</
div
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment