From 489e71677a52486a9ec554e84ee155fefa1aeb49 Mon Sep 17 00:00:00 2001 From: Grenaderova_Anastasia Date: Tue, 10 Oct 2023 22:17:23 +0400 Subject: [PATCH 1/2] lad2 done --- tasks/grenaderova-aa/lab_2/.gitignore | 454 ++++++++++++++++++ tasks/grenaderova-aa/lab_2/2lab/1.png | Bin 0 -> 164230 bytes tasks/grenaderova-aa/lab_2/2lab/2.png | Bin 0 -> 226098 bytes tasks/grenaderova-aa/lab_2/2lab/3.png | Bin 0 -> 137766 bytes tasks/grenaderova-aa/lab_2/README.md | 84 ++++ tasks/grenaderova-aa/lab_2/data/data.txt | 3 + tasks/grenaderova-aa/lab_2/data/data1.txt | 2 + tasks/grenaderova-aa/lab_2/data/data2.txt | 1 + tasks/grenaderova-aa/lab_2/docker-compose.yml | 18 + tasks/grenaderova-aa/lab_2/lab_2.sln | 48 ++ tasks/grenaderova-aa/lab_2/result-1/data.txt | 3 + tasks/grenaderova-aa/lab_2/result/result.txt | 1 + .../grenaderova-aa/lab_2/worker-1/Dockerfile | 18 + .../grenaderova-aa/lab_2/worker-1/Program.cs | 42 ++ .../lab_2/worker-1/worker-1.csproj | 9 + .../grenaderova-aa/lab_2/worker-2/Dockerfile | 18 + .../grenaderova-aa/lab_2/worker-2/Program.cs | 38 ++ .../lab_2/worker-2/worker-2.csproj | 9 + 18 files changed, 748 insertions(+) create mode 100644 tasks/grenaderova-aa/lab_2/.gitignore create mode 100644 tasks/grenaderova-aa/lab_2/2lab/1.png create mode 100644 tasks/grenaderova-aa/lab_2/2lab/2.png create mode 100644 tasks/grenaderova-aa/lab_2/2lab/3.png create mode 100644 tasks/grenaderova-aa/lab_2/README.md create mode 100644 tasks/grenaderova-aa/lab_2/data/data.txt create mode 100644 tasks/grenaderova-aa/lab_2/data/data1.txt create mode 100644 tasks/grenaderova-aa/lab_2/data/data2.txt create mode 100644 tasks/grenaderova-aa/lab_2/docker-compose.yml create mode 100644 tasks/grenaderova-aa/lab_2/lab_2.sln create mode 100644 tasks/grenaderova-aa/lab_2/result-1/data.txt create mode 100644 tasks/grenaderova-aa/lab_2/result/result.txt create mode 100644 tasks/grenaderova-aa/lab_2/worker-1/Dockerfile create mode 100644 tasks/grenaderova-aa/lab_2/worker-1/Program.cs create mode 100644 tasks/grenaderova-aa/lab_2/worker-1/worker-1.csproj create mode 100644 tasks/grenaderova-aa/lab_2/worker-2/Dockerfile create mode 100644 tasks/grenaderova-aa/lab_2/worker-2/Program.cs create mode 100644 tasks/grenaderova-aa/lab_2/worker-2/worker-2.csproj diff --git a/tasks/grenaderova-aa/lab_2/.gitignore b/tasks/grenaderova-aa/lab_2/.gitignore new file mode 100644 index 0000000..8afdcb6 --- /dev/null +++ b/tasks/grenaderova-aa/lab_2/.gitignore @@ -0,0 +1,454 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# JetBrains Rider +.idea/ +*.sln.iml + +## +## Visual Studio Code +## +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json diff --git a/tasks/grenaderova-aa/lab_2/2lab/1.png b/tasks/grenaderova-aa/lab_2/2lab/1.png new file mode 100644 index 0000000000000000000000000000000000000000..a2a5af88a90cff87c49419e7f1562d7e12cd51cb GIT binary patch literal 164230 zcmeI5?{5^x9fwK(guYrUi9|!nuL!7`U<0wiArK1qM~Q<0JGeALATXq0nir|5A|shb zNhM^Fs7V8j`i`nfn@H)4h$e6PBB9F5sQq)M^S$(QjECLZJ+p`R_8z2V?`CIb=Dzdn zS}5d#>2 z0T^h(0IuZc1V1Zb00#0Iz?Jzif+J!C12BLqVE_-n01V_afGhK31V_XO24DbJ!T=tC z0T{?<09WS62#$ym48Q=cgaJGN12B-!0ItlB5gZXC7=Qs>2?KZl24Enc0bH3MBRC>P zFaQI%5(e-948TA>1Gq9jMsP%oU;qYiB@EyJ7=VF%25@D5jKtB*iNr14JMFhCjcwaa z|N72$ci_&I=J&HK+}zMSKIikz&2M+MPm=A;Jah9_&i7>`^OKEqD@SQFcdxjGo7s3D6$9YtqwK+UbZH?Pv^@eF_ZPVvxUz`bB^-Li*lvqS@14RPV8&sIpBS@bZ>H*i?&(X-F+@B$NUufN_EMDR?dPi zN9C&iaIbShSH>P!-Dywe|vR2Y+G0duj_aHcWa;a_4T>kpW5Z@SSLPLon86w+f(j8|NSm?`}mvhd_1QL$JD$dcc~xbme4(+^DJNNLHRRu znmIQvJ5EchU+qZSt8KCO`q2 z`Mb(c`$LcG7<>F!6$YMo@^SCSF?Y#(a&Yw7rWd#F*yL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ZBN%`ITnPhs00v+np8;H%A0s#- zMlb*axDp2N01UuDJ_EQiKSppwj9>r;aOHq|{lb7>kLFx+Eu7KY{`Dt^+{`Cen!iJF z{q_sZV9^3PumWN z>&SZF&8{?0e*4c`?$dvK?Y{o{bMMQ~+xBGm!i?)23HO>pim1ztY8CRyAmsMX{Uea=|9Y0PdM!ge*y?b`Klm9ZxklRsWEUw+}*@ukLt;XGX9$8hdE@9#b8*^bp`E)B0Hb=(e$~aFr|F$uv&edMd)ICe3hklLQ&indZ-}GsDeQM8crqAcQ z^5@6*_58T<%`xx67M>KBEAgey)joEm(zEt*sT`S=kM#1c9b(yAu^b-U>5iQ~*m7L? z>P7#2=TK*!?{w3+^7qFF+Z-tX%X6g_jX}y_*T#)g z=a$dKPx@y%=1CiSmQhDq8Mre2y2F*}aYA-bBVj4&b#{@zU)oT@f-dAung4Im1%L&STmWQ zY&tY8A8FOUu3mced1qTE`%1iM{f}^e;Ev5vsvjrXSY99Xk}Hjyr90dGcoWXM`5Jn9 V(~sQP*W{{f;pqUrzu literal 0 HcmV?d00001 diff --git a/tasks/grenaderova-aa/lab_2/2lab/2.png b/tasks/grenaderova-aa/lab_2/2lab/2.png new file mode 100644 index 0000000000000000000000000000000000000000..e4bb624b309d49f2f43ccd86d87f3bde57547526 GIT binary patch literal 226098 zcmeI5Pm3MddB$b(4YHcu&9aF!CK-q`V8?+tf-r*z2_zVSJZ1)hMOrx6kq3J*-SmW* zaYAU!EF>D?$O~bbCOfYOI=h5k8s`J#gH-Bi`O$s#_NjljZ}qLZ{TryMTUF=0=bY#L zoqBHlY2Cm1?mPeVM>q7}H|k}lUjFZEH*Wl-UVrVzpVa?<_1}{}zHvi~|9k7Lx2l^r zZ&r)Nf&~p=00v+H24G+V4B*9l2U%=@JKBUh7=Qs7STcYYFSURRw15E^fB_iT1Os?6 z+--t8+Jrk8fB_g-GJqE^wSWt>fB_hQ0T|c>19&mqZGt=6ggY330T@^^fEO>dfD5#M z0T_S*7}x{@crn~fB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()!&U?r|@dCE0C#Z+w8vXQLBga+eQWszU z!@aiTgE1@5F*fGTapX+A4<7J0A~-)wO+>t7Yg)pgRzGSFKJ={__{KP{lengUJ@-x4 zLG59FElrGd&h0I$^0OA^YPXgqVqNn2o-Jzv%3uK8wGTz`w{wz^-wNg ze%u#$f2t-j266`N6F&8?SLT3rY)y5}S)6l^BX793v98RS>xVH#?0KJ9u|^!PYY=_( z%X9ico8u$n<2a1jP5*`j_AAyEwiq|^$jym+1LHfdww5L;7O@tm$yMui8at)A@8CD6 z2Y+eb`~-S9?l-6qLQqv)urFW;l`Nvo7(A-VBAF<`<;6BY7 zGbZM^%A9DU=Cw7k`&>yqeCMzDJ?X{NLvU&8zFm`ln{JzX=RN4*&Ij#Kyi>7VhbHR# zW5frY$bGKwi=BFS{lj}H$8mp?(PyvLy|{0$qKQ*$I+V-H3G>`;O|i8$jeR0d9m31=cd!* zG&kg(+&S=n Dm;U$m literal 0 HcmV?d00001 diff --git a/tasks/grenaderova-aa/lab_2/README.md b/tasks/grenaderova-aa/lab_2/README.md new file mode 100644 index 0000000..595517a --- /dev/null +++ b/tasks/grenaderova-aa/lab_2/README.md @@ -0,0 +1,84 @@ +# Отчёт по лабораторной работе №2 + +Выполнил: студентка гр. ИСЭбд-41, Гренадерова А.А. + +Вариант программы 1: 1. Ищет в каталоге /var/data файл с наибольшим количеством строк и перекладывает его в /var/result/data.txt. + +Вариант программы 2: 2. Ищет наименьшее число из файла /var/data/data.txt и сохраняет его третью степень в /var/result/result.txt. + +## Создание приложений + +Создадим 2 приложения. +Был выбран язык C# и технология .NET 5. + +Для создания обычных консольных приложений воспользуемся командами: + +```sh +dotnet new console -o worker-1 +dotnet new console -o worker-2 +``` + +Согласно варианту, программа 1 должна найти в каталоге /var/data файл с наибольшим количеством строк и переложить его в /var/result/data.txt. + +[Исходный текст программы worker-1](worker-1/Program.cs) + +Согласно варианту программа 2 должна найти наименьшее число из файла /var/data/data.txt и сохранить его третью степень в /var/result/result.txt. + +[Исходный текст программы worker-2](worker-2/Program.cs) + +Дополнительно создан файл [.gitignore](.gitignore) для того, чтобы не закоммитить в git ничего лишнего. + +## Настройка окружения + +Для связи двух приложений воспользуемся следующей схемой: + +1. Каталог `./data` должен быть примонтирован в каталог `/var/data` для программы 1. + Оттуда будут браться исходные данные. +2. Каталог `./result-1` должен быть примонтирован в каталог `/var/result` для программы 2. + Туда будут складываться промежуточные данные. +3. Каталог `./result-1` также должен быть примонтирован в каталог `/var/data` для программы 2. + Оттуда будут браться промежуточные результаты. +4. Каталог `./result` должен быть примонтирован в каталог `/var/result` для программы 2. + Туда будут складывать результаты финальной обработки. + +Для каждой программы были созданы файлы Dockerfile ([программа 1](worker-1/Dockerfile), [программа 2](worker-1/Dockerfile)) с подробным описанием процесса сборки. + +Был создан файл [docker-compose.yml](docker-compose.yml), в котором указан манифест для запуска распределённого приложения. + + +## Сборка и запуск + +1. В каталог `./data` помещены 3 файла с различной длиной названия и содержимым. + +![](2lab/1.png) + +На выходе программа должна записать файл data.txt, как самый длинный по количеству строк. + +![](2lab/2.png) + +2. Теперь, обрабатывая этот файл: + +![](2lab/2.png) + +На выходе программа должна записать число 1212 в 3 степени в `./result` так как в файле c названием data.txt оно минимальное. + +![](2lab/3.png) + +Для запуска приложения необходимо ввести команду `docker compose up --build`. +Результат запуска после сборки: + +``` +[+] Running 2/0 + ✔ Container lab_2-worker-1-1 Created 0.0s + ✔ Container lab_2-worker-2-1 Created 0.0s +Attaching to lab_2-worker-1-1, lab_2-worker-2-1 +lab_2-worker-1-1 | Файл успешно создан: ../var/result/data.txt +lab_2-worker-2-1 | The maximum number is: 8 +lab_2-worker-2-1 | The count of maximum numbers is: 2 +lab_2-worker-1-1 exited with code 0 +lab_2-worker-2-1 exited with code 0 +``` + +В результате в каталоге `./result` создался файл `result.txt` с содержимым `1780360128`, что соответствует входным данным. + +Изменение значений в файлах из каталога `./data` также изменяет содержимое в файлах из каталогов `./result-1` и `./result`. \ No newline at end of file diff --git a/tasks/grenaderova-aa/lab_2/data/data.txt b/tasks/grenaderova-aa/lab_2/data/data.txt new file mode 100644 index 0000000..1c2299f --- /dev/null +++ b/tasks/grenaderova-aa/lab_2/data/data.txt @@ -0,0 +1,3 @@ +1213 +1212 +12132 \ No newline at end of file diff --git a/tasks/grenaderova-aa/lab_2/data/data1.txt b/tasks/grenaderova-aa/lab_2/data/data1.txt new file mode 100644 index 0000000..52e0399 --- /dev/null +++ b/tasks/grenaderova-aa/lab_2/data/data1.txt @@ -0,0 +1,2 @@ +123213 +2131 \ No newline at end of file diff --git a/tasks/grenaderova-aa/lab_2/data/data2.txt b/tasks/grenaderova-aa/lab_2/data/data2.txt new file mode 100644 index 0000000..096fa64 --- /dev/null +++ b/tasks/grenaderova-aa/lab_2/data/data2.txt @@ -0,0 +1 @@ +12321 \ No newline at end of file diff --git a/tasks/grenaderova-aa/lab_2/docker-compose.yml b/tasks/grenaderova-aa/lab_2/docker-compose.yml new file mode 100644 index 0000000..9c753e7 --- /dev/null +++ b/tasks/grenaderova-aa/lab_2/docker-compose.yml @@ -0,0 +1,18 @@ +version: "3.1" +services: + worker-1: + build: ./worker-1 + volumes: + # Монтирует локальную папку data к папке data в контейнере. + - ./data:/var/data + # Монтирует локальную папку result-1 к папке result в контейнере. + - ./result-1:/var/result + worker-2: + build: ./worker-2 + volumes: + # Монтирует локальную папку result-1 к папке data в контейнере. + - ./result-1:/var/data + - ./result:/var/result + # Зависимость от первого приложения. + depends_on: + - worker-1 \ No newline at end of file diff --git a/tasks/grenaderova-aa/lab_2/lab_2.sln b/tasks/grenaderova-aa/lab_2/lab_2.sln new file mode 100644 index 0000000..81d50d3 --- /dev/null +++ b/tasks/grenaderova-aa/lab_2/lab_2.sln @@ -0,0 +1,48 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "worker-1", "worker-1\worker-1.csproj", "{5B8F3FD2-C7C4-4180-80C2-3752B0648684}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "worker-2", "worker-2\worker-2.csproj", "{7EF62CE7-C74B-4B2F-BC91-25A367B9450E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5B8F3FD2-C7C4-4180-80C2-3752B0648684}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5B8F3FD2-C7C4-4180-80C2-3752B0648684}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5B8F3FD2-C7C4-4180-80C2-3752B0648684}.Debug|x64.ActiveCfg = Debug|Any CPU + {5B8F3FD2-C7C4-4180-80C2-3752B0648684}.Debug|x64.Build.0 = Debug|Any CPU + {5B8F3FD2-C7C4-4180-80C2-3752B0648684}.Debug|x86.ActiveCfg = Debug|Any CPU + {5B8F3FD2-C7C4-4180-80C2-3752B0648684}.Debug|x86.Build.0 = Debug|Any CPU + {5B8F3FD2-C7C4-4180-80C2-3752B0648684}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5B8F3FD2-C7C4-4180-80C2-3752B0648684}.Release|Any CPU.Build.0 = Release|Any CPU + {5B8F3FD2-C7C4-4180-80C2-3752B0648684}.Release|x64.ActiveCfg = Release|Any CPU + {5B8F3FD2-C7C4-4180-80C2-3752B0648684}.Release|x64.Build.0 = Release|Any CPU + {5B8F3FD2-C7C4-4180-80C2-3752B0648684}.Release|x86.ActiveCfg = Release|Any CPU + {5B8F3FD2-C7C4-4180-80C2-3752B0648684}.Release|x86.Build.0 = Release|Any CPU + {7EF62CE7-C74B-4B2F-BC91-25A367B9450E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7EF62CE7-C74B-4B2F-BC91-25A367B9450E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7EF62CE7-C74B-4B2F-BC91-25A367B9450E}.Debug|x64.ActiveCfg = Debug|Any CPU + {7EF62CE7-C74B-4B2F-BC91-25A367B9450E}.Debug|x64.Build.0 = Debug|Any CPU + {7EF62CE7-C74B-4B2F-BC91-25A367B9450E}.Debug|x86.ActiveCfg = Debug|Any CPU + {7EF62CE7-C74B-4B2F-BC91-25A367B9450E}.Debug|x86.Build.0 = Debug|Any CPU + {7EF62CE7-C74B-4B2F-BC91-25A367B9450E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7EF62CE7-C74B-4B2F-BC91-25A367B9450E}.Release|Any CPU.Build.0 = Release|Any CPU + {7EF62CE7-C74B-4B2F-BC91-25A367B9450E}.Release|x64.ActiveCfg = Release|Any CPU + {7EF62CE7-C74B-4B2F-BC91-25A367B9450E}.Release|x64.Build.0 = Release|Any CPU + {7EF62CE7-C74B-4B2F-BC91-25A367B9450E}.Release|x86.ActiveCfg = Release|Any CPU + {7EF62CE7-C74B-4B2F-BC91-25A367B9450E}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/tasks/grenaderova-aa/lab_2/result-1/data.txt b/tasks/grenaderova-aa/lab_2/result-1/data.txt new file mode 100644 index 0000000..1c2299f --- /dev/null +++ b/tasks/grenaderova-aa/lab_2/result-1/data.txt @@ -0,0 +1,3 @@ +1213 +1212 +12132 \ No newline at end of file diff --git a/tasks/grenaderova-aa/lab_2/result/result.txt b/tasks/grenaderova-aa/lab_2/result/result.txt new file mode 100644 index 0000000..61bf70b --- /dev/null +++ b/tasks/grenaderova-aa/lab_2/result/result.txt @@ -0,0 +1 @@ +1780360128 \ No newline at end of file diff --git a/tasks/grenaderova-aa/lab_2/worker-1/Dockerfile b/tasks/grenaderova-aa/lab_2/worker-1/Dockerfile new file mode 100644 index 0000000..e4756e5 --- /dev/null +++ b/tasks/grenaderova-aa/lab_2/worker-1/Dockerfile @@ -0,0 +1,18 @@ +# Задаем базовый образ на .net +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env +# Задаем рабочую директорию +WORKDIR /src + + +# Копируем файлы и папки в каталог в контейнер +COPY . ./ +# Создаем образы и устанавливаем данные пакеты в контейнер +RUN dotnet restore +COPY . . +RUN dotnet publish -c Release -o /publish + +FROM mcr.microsoft.com/dotnet/aspnet:5.0 +WORKDIR /publish +COPY --from=build-env /publish . +# Вызываем приложение во время выполнения контейнера +ENTRYPOINT ["dotnet", "worker-1.dll"] \ No newline at end of file diff --git a/tasks/grenaderova-aa/lab_2/worker-1/Program.cs b/tasks/grenaderova-aa/lab_2/worker-1/Program.cs new file mode 100644 index 0000000..030c6ca --- /dev/null +++ b/tasks/grenaderova-aa/lab_2/worker-1/Program.cs @@ -0,0 +1,42 @@ +using System; +using System.IO; + +class Program +{ + static void Main(string[] args) + { + string sourceDirectory = "../var/data"; + string destDirectory = "../var/result"; + string destFile = Path.Combine(destDirectory, "data.txt"); + + // Получаем все файлы в исходном каталоге + string[] files = Directory.GetFiles(sourceDirectory); + + int maxLines = 0; + string filePath = ""; + + foreach (string file in files) + { + // Считываем строки из файла + string[] lines = File.ReadAllLines(file); + + // Проверяем количество строк в файле + if (lines.Length > maxLines) + { + maxLines = lines.Length; + filePath = file; + } + } + + // Копируем файл с наибольшим количеством строк в новое место + if (!string.IsNullOrEmpty(filePath)) + { + File.Copy(filePath, destFile, true); + Console.WriteLine($"Файл с наибольшим количеством строк перекладывается в {destFile}"); + } + else + { + Console.WriteLine("Файлы не найдены в исходном каталоге"); + } + } +} diff --git a/tasks/grenaderova-aa/lab_2/worker-1/worker-1.csproj b/tasks/grenaderova-aa/lab_2/worker-1/worker-1.csproj new file mode 100644 index 0000000..328500d --- /dev/null +++ b/tasks/grenaderova-aa/lab_2/worker-1/worker-1.csproj @@ -0,0 +1,9 @@ + + + + Exe + net5.0 + worker_1 + + + diff --git a/tasks/grenaderova-aa/lab_2/worker-2/Dockerfile b/tasks/grenaderova-aa/lab_2/worker-2/Dockerfile new file mode 100644 index 0000000..f80c2dc --- /dev/null +++ b/tasks/grenaderova-aa/lab_2/worker-2/Dockerfile @@ -0,0 +1,18 @@ +# Задаем базовый образ на .net +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env +# Задаем рабочую директорию +WORKDIR /src + + +# Копируем файлы и папки в каталог в контейнер +COPY . ./ +# Создаем образы и устанавливаем данные пакеты в контейнер +RUN dotnet restore +COPY . . +RUN dotnet publish -c Release -o /publish + +FROM mcr.microsoft.com/dotnet/aspnet:5.0 +WORKDIR /publish +COPY --from=build-env /publish . +# Вызываем приложение во время выполнения контейнера +ENTRYPOINT ["dotnet", "worker-2.dll"] \ No newline at end of file diff --git a/tasks/grenaderova-aa/lab_2/worker-2/Program.cs b/tasks/grenaderova-aa/lab_2/worker-2/Program.cs new file mode 100644 index 0000000..c013f48 --- /dev/null +++ b/tasks/grenaderova-aa/lab_2/worker-2/Program.cs @@ -0,0 +1,38 @@ +using System; +using System.IO; + +class Program +{ + static void Main(string[] args) + { + string sourceFile = "../var/data/data.txt"; + string resultFile = "../var/result/result.txt"; + + // Считываем числа из файла + string[] lines = File.ReadAllLines(sourceFile); + + // Переменная для хранения наименьшего числа + int smallestNumber = int.MaxValue; + + // Проходимся по всем числам в файле + foreach (string line in lines) + { + if (int.TryParse(line, out int number)) + { + // Если число меньше текущего наименьшего, обновляем значение + if (number < smallestNumber) + { + smallestNumber = number; + } + } + } + + // Возведение в третью степень + double result = Math.Pow(smallestNumber, 3); + + // Записываем результат в файл + File.WriteAllText(resultFile, result.ToString()); + + Console.WriteLine("Наименьшее число из файла data.txt возведено в третью степень и сохранено в файле result.txt"); + } +} diff --git a/tasks/grenaderova-aa/lab_2/worker-2/worker-2.csproj b/tasks/grenaderova-aa/lab_2/worker-2/worker-2.csproj new file mode 100644 index 0000000..fb2480c --- /dev/null +++ b/tasks/grenaderova-aa/lab_2/worker-2/worker-2.csproj @@ -0,0 +1,9 @@ + + + + Exe + net5.0 + worker_2 + + + From 70a8b96edda5cf0acb33644e3a22aef0ce3bfabd Mon Sep 17 00:00:00 2001 From: Grenaderova_Anastasia Date: Tue, 17 Oct 2023 12:08:10 +0400 Subject: [PATCH 2/2] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=202=20=D0=9B=D0=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tasks/grenaderova-aa/lab_2/README.md | 2 +- tasks/grenaderova-aa/lab_2/worker-1/Program.cs | 4 ++-- tasks/grenaderova-aa/lab_2/worker-2/Program.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tasks/grenaderova-aa/lab_2/README.md b/tasks/grenaderova-aa/lab_2/README.md index 595517a..f0465d3 100644 --- a/tasks/grenaderova-aa/lab_2/README.md +++ b/tasks/grenaderova-aa/lab_2/README.md @@ -41,7 +41,7 @@ dotnet new console -o worker-2 4. Каталог `./result` должен быть примонтирован в каталог `/var/result` для программы 2. Туда будут складывать результаты финальной обработки. -Для каждой программы были созданы файлы Dockerfile ([программа 1](worker-1/Dockerfile), [программа 2](worker-1/Dockerfile)) с подробным описанием процесса сборки. +Для каждой программы были созданы файлы Dockerfile ([программа 1](worker-1/Dockerfile), [программа 2](worker-2/Dockerfile)) с подробным описанием процесса сборки. Был создан файл [docker-compose.yml](docker-compose.yml), в котором указан манифест для запуска распределённого приложения. diff --git a/tasks/grenaderova-aa/lab_2/worker-1/Program.cs b/tasks/grenaderova-aa/lab_2/worker-1/Program.cs index 030c6ca..0146151 100644 --- a/tasks/grenaderova-aa/lab_2/worker-1/Program.cs +++ b/tasks/grenaderova-aa/lab_2/worker-1/Program.cs @@ -5,8 +5,8 @@ class Program { static void Main(string[] args) { - string sourceDirectory = "../var/data"; - string destDirectory = "../var/result"; + string sourceDirectory = "/var/data"; + string destDirectory = "/var/result"; string destFile = Path.Combine(destDirectory, "data.txt"); // Получаем все файлы в исходном каталоге diff --git a/tasks/grenaderova-aa/lab_2/worker-2/Program.cs b/tasks/grenaderova-aa/lab_2/worker-2/Program.cs index c013f48..52eba20 100644 --- a/tasks/grenaderova-aa/lab_2/worker-2/Program.cs +++ b/tasks/grenaderova-aa/lab_2/worker-2/Program.cs @@ -5,8 +5,8 @@ class Program { static void Main(string[] args) { - string sourceFile = "../var/data/data.txt"; - string resultFile = "../var/result/result.txt"; + string sourceFile = "/var/data/data.txt"; + string resultFile = "/var/result/result.txt"; // Считываем числа из файла string[] lines = File.ReadAllLines(sourceFile);